diff options
author | Michon van Dooren <michon1992@gmail.com> | 2009-05-15 17:38:01 +0200 |
---|---|---|
committer | Dennis Friis <peavey@inspircd.org> | 2009-05-17 04:59:56 +0200 |
commit | e1b4184da2ece6c9e1518064ffe35b9404b3db18 (patch) | |
tree | 50dee0dcc82af72f7ec2ed90c15b879f2c12cff8 /src | |
parent | c7e57369f066ee9b7f9f62eacb19e2d10f8e13c5 (diff) | |
download | mana-e1b4184da2ece6c9e1518064ffe35b9404b3db18.tar.gz mana-e1b4184da2ece6c9e1518064ffe35b9404b3db18.tar.bz2 mana-e1b4184da2ece6c9e1518064ffe35b9404b3db18.tar.xz mana-e1b4184da2ece6c9e1518064ffe35b9404b3db18.zip |
Fixed the -S/--home-dir command line option.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 07bcd3f8..3c98ed27 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -215,6 +215,7 @@ struct Options std::string configPath; std::string updateHost; std::string dataPath; + std::string homeDir; std::string serverName; short serverPort; @@ -303,11 +304,16 @@ static void setUpdatesDir() * Initializes the home directory. On UNIX and FreeBSD, ~/.tmw is used. On * Windows and other systems we use the current working directory. */ -static void initHomeDir() +static void initHomeDir(const Options &options) { - homeDir = std::string(PHYSFS_getUserDir()) + - "/." + - branding.getValue("appShort", "tmw"); + homeDir = options.homeDir; + + if (homeDir.empty()) + { + homeDir = std::string(PHYSFS_getUserDir()) + + "/." + + branding.getValue("appShort", "tmw"); + } #if defined WIN32 if (!CreateDirectory(homeDir.c_str(), 0) && GetLastError() != ERROR_ALREADY_EXISTS) @@ -660,7 +666,7 @@ static void parseOptions(int argc, char *argv[], Options &options) options.printVersion = true; break; case 'S': - homeDir = optarg; + options.homeDir = optarg; break; case 'O': options.noOpenGL = true; @@ -894,7 +900,7 @@ int main(int argc, char *argv[]) // Load branding information branding.init("data/branding.xml"); - initHomeDir(); + initHomeDir(options); // Configure logger logger = new Logger; |