From 1f56d71f190c67325bdc413dfbc6c8e4b8284d98 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 19 Mar 2012 20:44:07 +0200 Subject: Rework directory structure --- src/main.cpp | 11 ++++++++--- src/server.cpp | 6 +----- src/server.h | 3 --- src/subgame.cpp | 24 +++++++++--------------- 4 files changed, 18 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index d08f88417..35595e5aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1033,8 +1033,13 @@ int main(int argc, char *argv[]) // No specific world was commanded // Check if the world is found from the default directory, and if // not, see if the legacy world directory exists. - world_path = porting::path_user + DIR_DELIM + "server" + DIR_DELIM + "worlds" + DIR_DELIM + "world"; - std::string legacy_world_path = porting::path_user+DIR_DELIM+".."+DIR_DELIM+"world"; + world_path = porting::path_user + DIR_DELIM + "worlds" + DIR_DELIM + "world"; +#ifdef RUN_IN_PLACE + std::string legacy_world_path = porting::path_user + DIR_DELIM + + ".." + DIR_DELIM + "world"; +#else + std::string legacy_world_path = porting::path_user + DIR_DELIM + "world"; +#endif if(!fs::PathExists(world_path) && fs::PathExists(legacy_world_path)){ errorstream<<"Warning: Using legacy world directory \"" < m_async_fatal_error; diff --git a/src/subgame.cpp b/src/subgame.cpp index d34530193..b4ae3185e 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -27,14 +27,13 @@ SubgameSpec findSubgame(const std::string &id) { if(id == "") return SubgameSpec(); - std::string share_server = porting::path_share + DIR_DELIM + "server"; - std::string user_server = porting::path_user + DIR_DELIM + "server"; + std::string share = porting::path_share; + std::string user = porting::path_user; // Find game directory - std::string game_path = - user_server + DIR_DELIM + "games" + DIR_DELIM + id; + std::string game_path = user + DIR_DELIM + "games" + DIR_DELIM + id; bool user_game = true; // Game is in user's directory if(!fs::PathExists(game_path)){ - game_path = share_server + DIR_DELIM + "games" + DIR_DELIM + id; + game_path = share + DIR_DELIM + "games" + DIR_DELIM + id; user_game = false; } if(!fs::PathExists(game_path)) @@ -42,10 +41,8 @@ SubgameSpec findSubgame(const std::string &id) // Find addon directories std::set addon_paths; if(!user_game) - addon_paths.insert(share_server + DIR_DELIM + "addons" - + DIR_DELIM + id); - addon_paths.insert(user_server + DIR_DELIM + "addons" - + DIR_DELIM + id); + addon_paths.insert(share + DIR_DELIM + "addons" + DIR_DELIM + id); + addon_paths.insert(user + DIR_DELIM + "addons" + DIR_DELIM + id); // TODO: Read proper name from game_path/game.conf std::string game_name = id; return SubgameSpec(id, game_path, addon_paths, game_name); @@ -55,10 +52,8 @@ std::set getAvailableGameIds() { std::set gameids; std::set gamespaths; - gamespaths.insert(porting::path_share + DIR_DELIM + "server" - + DIR_DELIM + "games"); - gamespaths.insert(porting::path_user + DIR_DELIM + "server" - + DIR_DELIM + "games"); + gamespaths.insert(porting::path_share + DIR_DELIM + "games"); + gamespaths.insert(porting::path_user + DIR_DELIM + "games"); for(std::set::const_iterator i = gamespaths.begin(); i != gamespaths.end(); i++){ std::vector dirlist = fs::GetDirListing(*i); @@ -105,8 +100,7 @@ std::vector getAvailableWorlds() { std::vector worlds; std::set worldspaths; - worldspaths.insert(porting::path_user + DIR_DELIM + "server" - + DIR_DELIM + "worlds"); + worldspaths.insert(porting::path_user + DIR_DELIM + "worlds"); infostream<<"Searching worlds..."<::const_iterator i = worldspaths.begin(); i != worldspaths.end(); i++){ -- cgit v1.2.3