summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMichon van Dooren <michon1992@gmail.com>2009-02-11 22:43:52 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-12 00:44:00 +0100
commitdbb6d32469e257d6325c3ed0725b5ccb32fad844 (patch)
tree53525271c751085e46156b656c7150842dc94fb6 /src/main.cpp
parentd2876ad85935c5d0b181d050bd4c19a4682123b1 (diff)
downloadmana-client-dbb6d32469e257d6325c3ed0725b5ccb32fad844.tar.gz
mana-client-dbb6d32469e257d6325c3ed0725b5ccb32fad844.tar.bz2
mana-client-dbb6d32469e257d6325c3ed0725b5ccb32fad844.tar.xz
mana-client-dbb6d32469e257d6325c3ed0725b5ccb32fad844.zip
Added command line option to set home directory path
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 051840f1..91ae87e9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -213,7 +213,8 @@ void setUpdatesDir()
*/
void init_engine(const Options &options)
{
- homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
+ if (homeDir.empty())
+ homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
#if defined WIN32
if (!CreateDirectory(homeDir.c_str(), 0) &&
GetLastError() != ERROR_ALREADY_EXISTS)
@@ -451,7 +452,8 @@ void printHelp()
<< " -D --default : Bypass the login process with default settings" << std::endl
<< " -p --playername : Login with this player" << std::endl
<< " -C --configfile : Configuration file to use" << std::endl
- << " -H --updatehost : Use this update host" << std::endl;
+ << " -H --updatehost : Use this update host" << std::endl
+ << " -S --homedir : Directory to use as home directory" << std::endl;
}
void printVersion()
@@ -466,7 +468,7 @@ void printVersion()
void parseOptions(int argc, char *argv[], Options &options)
{
- const char *optstring = "hvud:U:P:Dp:C:H:";
+ const char *optstring = "hvud:U:P:Dp:C:H:S:";
const struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
@@ -479,6 +481,7 @@ void parseOptions(int argc, char *argv[], Options &options)
{ "playername", required_argument, 0, 'p' },
{ "configfile", required_argument, 0, 'C' },
{ "updatehost", required_argument, 0, 'H' },
+ { "homedir", required_argument, 0, 'S' },
{ 0 }
};
@@ -521,6 +524,9 @@ void parseOptions(int argc, char *argv[], Options &options)
case 'H':
options.updateHost = optarg;
break;
+ case 'S':
+ homeDir = optarg;
+ break;
}
}
}