diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/client.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp index 315fcd410..94b483802 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -782,11 +782,20 @@ void Client::initLocalMapSaving(const Address &address, return; } - const std::string world_path = porting::path_user - + DIR_DELIM + "worlds" - + DIR_DELIM + "server_" + std::string world_path; +#define set_world_path(hostname) \ + world_path = porting::path_user \ + + DIR_DELIM + "worlds" \ + + DIR_DELIM + "server_" \ + hostname + "_" + std::to_string(address.getPort()); + set_world_path(hostname); + if (!fs::IsDir(world_path)) { + std::string hostname_escaped = hostname; + str_replace(hostname_escaped, ':', '_'); + set_world_path(hostname_escaped); + } +#undef set_world_path fs::CreateAllDirs(world_path); m_localdb = new MapDatabaseSQLite3(world_path); |