--- ./CMakeLists.txt 2021-10-14 05:27:34 +++ ./CMakeLists.txt 2023-08-30 10:48:55 @@ -37,4 +37,13 @@ RUNTIME DESTINATION bin) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data - DESTINATION ${CMAKE_INSTALL_PREFIX}) + DESTINATION ${CMAKE_INSTALL_PREFIX}/var/2048.cpp/ + DIRECTORY_PERMISSIONS + OWNER_WRITE OWNER_READ OWNER_EXECUTE + GROUP_WRITE GROUP_READ GROUP_EXECUTE + WORLD_WRITE WORLD_READ WORLD_EXECUTE + PATTERN "data/*" + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE + GROUP_WRITE GROUP_READ GROUP_EXECUTE + WORLD_WRITE WORLD_READ WORLD_EXECUTE + ) --- src/game-pregamemenu.cpp.ori 2020-03-31 17:44:45.000000000 +0800 +++ src/game-pregamemenu.cpp 2020-03-31 17:41:34.000000000 +0800 @@ -127,8 +127,8 @@ load_gameboard_status_t initialiseContinueBoardArray() { using namespace Loader; - constexpr auto gameboard_data_filename = "../data/previousGame"; - constexpr auto game_stats_data_filename = "../data/previousGameStats"; + constexpr auto gameboard_data_filename = "../var/2048.cpp/data/previousGame"; + constexpr auto game_stats_data_filename = "../var/2048.cpp/data/previousGameStats"; auto loaded_gameboard{false}; auto loaded_game_stats{false}; auto tempGBoard = GameBoard{1}; --- src/menu.cpp.ori 2020-03-31 17:44:46.000000000 +0800 +++ src/menu.cpp 2020-03-31 17:41:55.000000000 +0800 @@ -44,7 +44,7 @@ // bool loaded_scorelist; // Warning: Does not care if file exists or not! std::tie(std::ignore, scoreList) = - Scoreboard::loadFromFileScore("../data/scores.txt"); + Scoreboard::loadFromFileScore("../var/2048.cpp/data/scores.txt"); auto counter{1}; const auto convert_to_display_list_t = [&counter](const Scoreboard::Score s) { @@ -68,7 +68,7 @@ Statistics::total_game_stats_t stats; bool stats_file_loaded{}; std::tie(stats_file_loaded, stats) = - Statistics::loadFromFileStatistics("../data/statistics.txt"); + Statistics::loadFromFileStatistics("../var/2048.cpp/data/statistics.txt"); const auto tsdd = std::make_tuple( stats_file_loaded, std::to_string(stats.bestScore), --- src/saveresource.cpp.ori 2020-03-31 17:44:46.000000000 +0800 +++ src/saveresource.cpp 2020-03-31 17:42:02.000000000 +0800 @@ -35,8 +35,8 @@ void saveGamePlayState(GameBoard gb) { // Currently two datafiles for now. // Will be merged into one datafile in a future PR. - constexpr auto filename_game_data_state = "../data/previousGame"; - constexpr auto filename_game_data_statistics = "../data/previousGameStats"; + constexpr auto filename_game_data_state = "../var/2048.cpp/data/previousGame"; + constexpr auto filename_game_data_statistics = "../var/2048.cpp/data/previousGameStats"; std::remove(filename_game_data_state); std::remove(filename_game_data_statistics); --- src/scores.cpp.ori 2020-03-31 17:44:47.000000000 +0800 +++ src/scores.cpp 2020-03-31 17:42:13.000000000 +0800 @@ -45,7 +45,7 @@ } void saveScore(Score finalscore) { - saveToFileScore("../data/scores.txt", finalscore); + saveToFileScore("../var/2048.cpp/data/scores.txt", finalscore); } } // namespace Scoreboard --- src/statistics.cpp.ori 2020-03-31 17:44:48.000000000 +0800 +++ src/statistics.cpp 2020-03-31 17:42:27.000000000 +0800 @@ -58,7 +58,7 @@ bool stats_file_loaded{}; ull tempscore{0}; std::tie(stats_file_loaded, stats) = - loadFromFileStatistics("../data/statistics.txt"); + loadFromFileStatistics("../var/2048.cpp/data/statistics.txt"); if (stats_file_loaded) { tempscore = stats.bestScore; } @@ -70,7 +70,7 @@ // Need some sort of stats data values only. // No need to care if file loaded successfully or not... std::tie(std::ignore, stats) = - loadFromFileStatistics("../data/statistics.txt"); + loadFromFileStatistics("../var/2048.cpp/data/statistics.txt"); stats.bestScore = stats.bestScore < finalscore.score ? finalscore.score : stats.bestScore; stats.gameCount++; @@ -78,7 +78,7 @@ stats.totalMoveCount += finalscore.moveCount; stats.totalDuration += finalscore.duration; - saveToFileEndGameStatistics("../data/statistics.txt", stats); + saveToFileEndGameStatistics("../var/2048.cpp/data/statistics.txt", stats); } void CreateFinalScoreAndEndGameDataFile(std::ostream &os, std::istream &is,