From 6a47bc1e2811b9f7cb59ae7afc7f9c00d1e1d60c Mon Sep 17 00:00:00 2001 From: John Date: Sun, 26 Feb 2023 07:51:03 -0800 Subject: [PATCH] Windows/msvc lockstep changes --- .../mcrogueface_msvc/mcrogueface_msvc.vcxproj | 4 +++- .../mcrogueface_msvc.vcxproj.filters | 6 ++++++ platform/windows/platform.h | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj b/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj index 71f9d40..b32f857 100644 --- a/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj +++ b/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj @@ -24,6 +24,7 @@ + @@ -34,6 +35,7 @@ + 16.0 @@ -155,7 +157,7 @@ true true true - NDEBUG;_CONSOLE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true stdcpp17 C:\Users\jpm68\Share\McRogueFace\deps_windows\posix-stub;C:\Users\jpm68\Share\McRogueFace\platform\windows;C:\Users\jpm68\Share\McRogueFace\deps_windows\SFML-2.5.1\include;C:\Users\jpm68\Share\McRogueFace\deps_windows\Python-3.11.1\Include;C:\Users\jpm68\Share\McRogueFace\deps_windows\Python-3.11.1\PC;C:\Users\jpm68\Share\McRogueFace\deps_windows\libtcod-1.23.1-x86_64-msvc\include;%(AdditionalIncludeDirectories) diff --git a/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj.filters b/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj.filters index a620a25..2743d08 100644 --- a/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj.filters +++ b/platform/windows/mcrogueface_msvc/mcrogueface_msvc.vcxproj.filters @@ -45,6 +45,9 @@ Source Files + + Source Files + @@ -56,5 +59,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/platform/windows/platform.h b/platform/windows/platform.h index 6bd093d..ee4176e 100644 --- a/platform/windows/platform.h +++ b/platform/windows/platform.h @@ -12,10 +12,28 @@ std::wstring executable_path() return exec_path.substr(0, path_index); } +std::wstring executable_filename() +{ + wchar_t buffer[MAX_PATH]; + GetModuleFileName(NULL, buffer, MAX_PATH); + std::wstring exec_path = buffer; + return exec_path; +} + std::wstring working_path() { auto cwd = std::filesystem::current_path(); return cwd.wstring(); } +std::string narrow_string(std::wstring convertme) +{ + //setup converter + using convert_type = std::codecvt_utf8; + std::wstring_convert converter; + + //use converter (.to_bytes: wstr->str, .from_bytes: str->wstr) + return converter.to_bytes(convertme); +} + #endif