summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeway <mewaysid92@gmail.com>2025-06-30 13:24:20 -0500
committerFedja Beader <fedja@protonmail.ch>2025-07-01 19:00:09 +0200
commite9a7250ddd286a062b6ff84f0a907f8318bad6d5 (patch)
tree4f04ff6d84015223912740c81c4c77aad3c0acc7
parent9b3c31f76cf208778f478fd9b7a5eefecf9d0f9b (diff)
downloadverse-e9a7250ddd286a062b6ff84f0a907f8318bad6d5.tar.gz
verse-e9a7250ddd286a062b6ff84f0a907f8318bad6d5.tar.bz2
verse-e9a7250ddd286a062b6ff84f0a907f8318bad6d5.tar.xz
verse-e9a7250ddd286a062b6ff84f0a907f8318bad6d5.zip
Just some changes to compile on windows - urlopen fixes
TODO: shouldn't spaces be replaced with %20, which is URL encoded space?
-rw-r--r--src/utils/process.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
index 10ee5581f..55c073fea 100644
--- a/src/utils/process.cpp
+++ b/src/utils/process.cpp
@@ -47,6 +47,8 @@ const int timeOut = 10;
#include "utils/stringutils.h"
#include <windows.h>
+#include <shellapi.h> // For ShellExecute
+#include <cstdint> // For std::intptr_t
int execFileWait(const std::string &pathName, const std::string &name A_UNUSED,
const std::string &arg1, const std::string &arg2,
@@ -257,7 +259,11 @@ bool openBrowser(std::string url)
#elif defined _WIN32
bool openBrowser(std::string url)
{
- return reinterpret_cast<int32_t>(ShellExecute(nullptr, "open",
+ return reinterpret_cast<std::intptr_t>(ShellExecute(nullptr, "open",
+ // Remove spaces from the URL to avoid issues with ShellExecute
+ // interpreting the URL incorrectly.
+ // This is a workaround for the issue where spaces in URLs can cause
+ // ShellExecute to fail.
replaceAll(url, " ", "").c_str(),
nullptr, nullptr, SW_SHOWNORMAL)) > 32;
}