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/servermain.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src/servermain.cpp') diff --git a/src/servermain.cpp b/src/servermain.cpp index 4194faaaa..5eb5162ae 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -163,17 +163,16 @@ 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); // 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 @@ -283,10 +282,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 @@ -334,28 +335,31 @@ int main(int argc, char *argv[]) // Port? u16 port = 30000; if(cmd_args.exists("port") && cmd_args.getU16("port") != 0) - { port = cmd_args.getU16("port"); - } else if(g_settings->exists("port") && g_settings->getU16("port") != 0) - { port = g_settings->getU16("port"); - } - else - { - dstream<<"Please specify port (in config or on command line)" - <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 \"" + <