diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index 0b880d5a..2ce219d3 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -85,4 +85,5 @@ add_copyredist_target(Minecraft.Client) # Make sure GameHDD exists on Windows if(PLATFORM_NAME STREQUAL "Windows64") add_gamehdd_target(Minecraft.Client) + add_settings_target(Minecraft.Client) endif() diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 72e68a97..64d16972 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -788,7 +788,7 @@ static void Win64_GetSettingsPath(char *outPath, DWORD size) GetModuleFileNameA(nullptr, outPath, size); char *lastSlash = strrchr(outPath, '\\'); if (lastSlash) *(lastSlash + 1) = '\0'; - strncat_s(outPath, size, "settings.dat", _TRUNCATE); + strncat_s(outPath, size, "Windows64/Settings/settings.dat", _TRUNCATE); } static void Win64_SaveSettings(GAME_SETTINGS *gs) { diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index 8e1e0ae5..7ab9830a 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -10,6 +10,18 @@ function(add_gamehdd_target TARGET_NAME) set_property(TARGET EnsureGameHDD_${TARGET_NAME} PROPERTY FOLDER "Build") endfunction() +# Make sure the Settings directory exists +function(add_settings_target TARGET_NAME) + add_custom_target(EnsureSettings_${TARGET_NAME} ALL + COMMAND ${CMAKE_COMMAND} + -E make_directory "$/Windows64/Settings" + COMMENT "Ensuring Settings directory exists..." + VERBATIM + ) + add_dependencies(${TARGET_NAME} EnsureSettings_${TARGET_NAME}) + set_property(TARGET EnsureSettings_${TARGET_NAME} PROPERTY FOLDER "Build") +endfunction() + # Copy any needed redist files to the output directory function(add_copyredist_target TARGET_NAME) set(COPY_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/CopyFolderScript.cmake")