diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index e226460f..7cd2b0e1 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -148,7 +148,8 @@ endif() # Copy redist files add_copyredist_target(Minecraft.Client) -# Make sure GameHDD exists on Windows +# Make sure GameHDD & Settings exists in Windows64 if(PLATFORM_NAME STREQUAL "Windows64") add_gamehdd_target(Minecraft.Client) + add_settings_target(Minecraft.Client) endif() \ No newline at end of file diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index a3c84c48..8871a414 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -895,7 +895,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..f5f4c4f3 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") @@ -22,7 +34,6 @@ function(add_copyredist_target TARGET_NAME) COMMENT "Copying redist files..." VERBATIM ) - add_dependencies(${TARGET_NAME} CopyRedist_${TARGET_NAME}) set_property(TARGET CopyRedist_${TARGET_NAME} PROPERTY FOLDER "Build") endfunction()