From c89d1cf072f4ac34cfb35eadd8c9890b3de1b922 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 10 Mar 2012 15:56:24 +0200 Subject: Initial directory structure rework --- src/main.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ec999c530..322d84e9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1157,19 +1157,18 @@ int main(int argc, char *argv[]) porting::signal_handler_init(); bool &kill = *porting::signal_handler_killstatus(); - // Initialize porting::path_data and porting::path_userdata porting::initializePaths(); // Create user data directory - fs::CreateDir(porting::path_userdata); + fs::CreateDir(porting::path_user); - init_gettext((porting::path_data+DIR_DELIM+".."+DIR_DELIM+"locale").c_str()); + init_gettext((porting::path_share+DIR_DELIM+".."+DIR_DELIM+"locale").c_str()); // Initialize debug streams #ifdef RUN_IN_PLACE std::string debugfile = DEBUGFILE; #else - std::string debugfile = porting::path_userdata+DIR_DELIM+DEBUGFILE; + std::string debugfile = porting::path_user+DIR_DELIM+DEBUGFILE; #endif debugstreams_init(disable_stderr, debugfile.c_str()); // Initialize debug stacks @@ -1221,10 +1220,12 @@ int main(int argc, char *argv[]) else { core::array filenames; - filenames.push_back(porting::path_userdata + + filenames.push_back(porting::path_user + DIR_DELIM + "minetest.conf"); #ifdef RUN_IN_PLACE - filenames.push_back(porting::path_userdata + + // Try also from a lower level (to aid having the same configuration + // for many RUN_IN_PLACE installs) + filenames.push_back(porting::path_user + DIR_DELIM + ".." + DIR_DELIM + "minetest.conf"); #endif @@ -1278,11 +1279,22 @@ int main(int argc, char *argv[]) port = 30000; // Map directory - std::string map_dir = porting::path_userdata+DIR_DELIM+"world"; + std::string map_dir = porting::path_user + DIR_DELIM + "server" + DIR_DELIM + "worlds" + DIR_DELIM + "world"; if(cmd_args.exists("map-dir")) map_dir = cmd_args.get("map-dir"); else if(g_settings->exists("map-dir")) map_dir = g_settings->get("map-dir"); + else{ + // No map-dir option was specified. + // Check if the world is found from the default directory, and if + // not, see if the legacy world directory exists. + std::string legacy_map_dir = porting::path_user+DIR_DELIM+".."+DIR_DELIM+"world"; + if(!fs::PathExists(map_dir) && fs::PathExists(legacy_map_dir)){ + errorstream<<"Warning: Using legacy world directory \"" + <