Use _WIN32
instead of WIN32
to detect Windows
`WIN32` is not defined when building a 64-bit executable on Windows with Clang. `_WIN32` is the more appropriate option here. http://web.archive.org/web/20191012035921/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system contains a handy table/matrix of the options and why this is best.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <shlobj.h>
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
@@ -79,7 +79,7 @@ void ExtProgStore::init ()
|
||||
|
||||
actions.clear ();
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
// Please do not add obscure little tools here, only widely used programs.
|
||||
// They should also have a proper setup program and therefore a standard path.
|
||||
@@ -104,7 +104,7 @@ void ExtProgStore::init ()
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
bool ExtProgStore::searchProgram (const Glib::ustring& name,
|
||||
const Glib::ustring& exePath,
|
||||
const Glib::ustring& exePath86,
|
||||
@@ -240,7 +240,7 @@ bool ExtProgStore::spawnCommandSync (const Glib::ustring& cmd)
|
||||
|
||||
bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
|
||||
{
|
||||
#if defined WIN32
|
||||
#if defined _WIN32
|
||||
|
||||
auto executable = Glib::build_filename (options.gimpDir, "bin", "gimp-win-remote");
|
||||
auto success = ShellExecute( NULL, "open", executable.c_str(), fileName.c_str(), NULL, SW_SHOWNORMAL );
|
||||
@@ -260,7 +260,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (reinterpret_cast<uintptr_t>(success) > 32) {
|
||||
return true;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
for (auto ver = 12; ver >= 0; --ver) {
|
||||
|
||||
@@ -300,7 +300,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
|
||||
|
||||
bool ExtProgStore::openInPhotoshop (const Glib::ustring& fileName)
|
||||
{
|
||||
#if defined WIN32
|
||||
#if defined _WIN32
|
||||
|
||||
const auto executable = Glib::build_filename(options.psDir, "Photoshop.exe");
|
||||
const auto cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + fileName + Glib::ustring("\"");
|
||||
@@ -324,7 +324,7 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName, const Glib
|
||||
command = &(options.customEditorProg);
|
||||
}
|
||||
|
||||
#if defined WIN32
|
||||
#if defined _WIN32
|
||||
|
||||
const auto cmdLine = Glib::ustring("\"") + *command + Glib::ustring("\"");
|
||||
auto success = ShellExecute( NULL, "open", cmdLine.c_str(), ('"' + fileName + '"').c_str(), NULL, SW_SHOWNORMAL );
|
||||
@@ -381,7 +381,7 @@ bool ExtProgStore::openInExternalEditor(const Glib::ustring &fileName, const Edi
|
||||
std::cout << "Unable to launch external editor with Gio. Trying custom launcher." << std::endl;
|
||||
}
|
||||
Glib::ustring command = editorInfo.commandline;
|
||||
#if defined WIN32
|
||||
#if defined _WIN32
|
||||
if (command.length() > 2 && command[0] == '"' && command[command.length() - 1] == '"') {
|
||||
command = command.substr(1, command.length() - 2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user