1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

Change inventory files place.

inventory is now in %appdata%/goldberg.../<appid>/inventory just like remote and stats.
It is also affected by the local_save.txt
This commit is contained in:
Nemirtingas 2019-09-18 14:53:04 +02:00
parent 420e498f22
commit 6c19056fbb
2 changed files with 3 additions and 14 deletions

View file

@ -53,11 +53,6 @@ std::string Local_Storage::get_global_settings_path()
return "";
}
std::string Local_Storage::get_global_inventory_path()
{
return "";
}
Local_Storage::Local_Storage(std::string save_directory)
{
@ -527,11 +522,6 @@ std::string Local_Storage::get_global_settings_path()
return save_directory + settings_storage_folder + PATH_SEPARATOR;
}
std::string Local_Storage::get_global_inventory_path()
{
return save_directory + inventory_storage_folder + PATH_SEPARATOR;
}
std::vector<std::string> Local_Storage::get_filenames_path(std::string path)
{
if (path.back() != *PATH_SEPARATOR) {
@ -703,7 +693,7 @@ bool Local_Storage::update_save_filenames(std::string folder)
bool Local_Storage::load_inventory_file(nlohmann::json& json, std::string const&file)
{
std::string inv_path = std::move(get_global_inventory_path() + appid + file);
std::string inv_path = std::move(save_directory + appid + inventory_storage_folder + PATH_SEPARATOR + file);
std::ifstream inventory_file(inv_path);
// If there is a file and we opened it
if (inventory_file)
@ -735,11 +725,11 @@ bool Local_Storage::load_inventory_file(nlohmann::json& json, std::string const&
bool Local_Storage::write_inventory_file(nlohmann::json const& json, std::string const&file)
{
std::string inv_path = std::move(get_global_inventory_path() + appid);
std::string inv_path = std::move(save_directory + appid + inventory_storage_folder);
create_directory(inv_path);
std::ofstream inventory_file(inv_path + file, std::ios::trunc | std::ios::out);
std::ofstream inventory_file(inv_path + PATH_SEPARATOR + file, std::ios::trunc | std::ios::out);
if (inventory_file)
{
inventory_file << std::setw(2) << json;

View file

@ -59,7 +59,6 @@ public:
bool file_delete(std::string folder, std::string file);
uint64_t file_timestamp(std::string folder, std::string file);
std::string get_global_settings_path();
std::string get_global_inventory_path();
std::string get_path(std::string folder);
bool update_save_filenames(std::string folder);