diff --git a/src/client/component/client_patches.cpp b/src/client/component/client_patches.cpp index 3a071e74..fe480e82 100644 --- a/src/client/component/client_patches.cpp +++ b/src/client/component/client_patches.cpp @@ -147,7 +147,7 @@ namespace client_patches } // TODO: Remove me after some time - void migrate_if_needed() + extern "C" void migrate_if_needed() { std::error_code e; diff --git a/src/common/utils/properties.cpp b/src/common/utils/properties.cpp index 22ac1561..d00c3704 100644 --- a/src/common/utils/properties.cpp +++ b/src/common/utils/properties.cpp @@ -16,6 +16,8 @@ namespace utils::properties { namespace { + extern "C" void migrate_if_needed(); + typedef rapidjson::EncodedOutputStream, rapidjson::FileWriteStream> OutputStream; typedef rapidjson::EncodedInputStream, rapidjson::FileReadStream> InputStream; @@ -27,7 +29,21 @@ namespace utils::properties std::filesystem::path get_properties_file() { - static auto props = get_properties_folder() / "properties.json"; + static auto props = [] + { + auto path = std::filesystem::path("boiii_players/properties.json"); + const auto legacy_path = get_properties_folder() / "properties.json"; + + migrate_if_needed(); + + if (io::file_exists(legacy_path) && !io::file_exists(path)) + { + std::error_code e; + std::filesystem::copy(legacy_path, path, std::filesystem::copy_options::skip_existing, e); + } + + return path; + }(); return props; }