summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMichon van Dooren <michon1992@gmail.com>2009-05-15 17:38:01 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-17 22:22:36 +0200
commit11f68b7cfe0833b8d5b2dc9aee2256b499812e7e (patch)
treeb49b8ed3359230a3bf63e8ac68d4615659389551 /src/main.cpp
parentda03d6fcdd76774fd97e94227f32b9574f52bc18 (diff)
downloadmana-11f68b7cfe0833b8d5b2dc9aee2256b499812e7e.tar.gz
mana-11f68b7cfe0833b8d5b2dc9aee2256b499812e7e.tar.bz2
mana-11f68b7cfe0833b8d5b2dc9aee2256b499812e7e.tar.xz
mana-11f68b7cfe0833b8d5b2dc9aee2256b499812e7e.zip
Fixed the -S/--home-dir command line option.
(cherry picked from commit e1b4184da2ece6c9e1518064ffe35b9404b3db18)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
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;