Use _WIN32 macro to detect Windows (instead of other macro variants)

This commit is contained in:
Nikita Lisitsa 2025-03-04 20:00:03 +03:00
parent 2e28b3ffc6
commit 4dc8b6a183
4 changed files with 5 additions and 6 deletions

View file

@ -15,7 +15,7 @@ namespace psemek::io
throw util::system_error(std::error_code{errno, std::system_category()}, "Failed to open " + path.string()); throw util::system_error(std::error_code{errno, std::system_category()}, "Failed to open " + path.string());
} }
#ifdef __WIN32__ #ifdef _WIN32
wchar_t const * fopen_read_mode() wchar_t const * fopen_read_mode()
{ {
return L"rb"; return L"rb";

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef WIN32 #ifdef _WIN32
#define PSEMEK_SDL2_DISCRETE_GPU \ #define PSEMEK_SDL2_DISCRETE_GPU \
extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 1; } \ extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 1; } \

View file

@ -2,7 +2,7 @@
#include <psemek/util/to_string.hpp> #include <psemek/util/to_string.hpp>
#include <psemek/util/exception.hpp> #include <psemek/util/exception.hpp>
#ifdef WIN32 #ifdef _WIN32
#include <libloaderapi.h> #include <libloaderapi.h>
#include <errhandlingapi.h> #include <errhandlingapi.h>
#include <winerror.h> #include <winerror.h>
@ -13,7 +13,7 @@ namespace psemek::util
std::filesystem::path executable_path() std::filesystem::path executable_path()
{ {
#if defined WIN32 #if defined _WIN32
std::wstring result(256, '\0'); std::wstring result(256, '\0');
while (true) while (true)
{ {

View file

@ -1,7 +1,6 @@
#include <psemek/util/open_url.hpp> #include <psemek/util/open_url.hpp>
#include <cstdlib> #include <cstdlib>
#include <thread>
namespace psemek::util namespace psemek::util
{ {
@ -13,7 +12,7 @@ namespace psemek::util
if (!url.starts_with("http")) if (!url.starts_with("http"))
url = "https://" + url; url = "https://" + url;
#ifdef WIN32 #ifdef _WIN32
url = "start " + url; url = "start " + url;
ignore(std::system(url.data())); ignore(std::system(url.data()));
#endif #endif