summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2009-12-09 17:51:17 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2009-12-09 18:13:14 +0100
commite356eb91b4edb860bb567cbcd467a43ef011c86f (patch)
tree0430d6c0f42b56b801a664cf6413b717b43fa0e7 /src/main.cpp
parent782b3d32ba1f713750bc4555ab7d28fd808b28e0 (diff)
downloadmana-e356eb91b4edb860bb567cbcd467a43ef011c86f.tar.gz
mana-e356eb91b4edb860bb567cbcd467a43ef011c86f.tar.bz2
mana-e356eb91b4edb860bb567cbcd467a43ef011c86f.tar.xz
mana-e356eb91b4edb860bb567cbcd467a43ef011c86f.zip
Unifying the default folder for screenshots and making it configurable
For all operating systems screenshots are now saved in ~/Desktop. If this folder does not exist, then the user's home is used. The players can change this with the new option --screenshot-dir. This patch is for http://mantis.themanaworld.org/view.php?id=969
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp68
1 files changed, 38 insertions, 30 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 73752c9e..0f070dd1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -181,6 +181,7 @@ struct Options
std::string updateHost;
std::string dataPath;
std::string homeDir;
+ std::string screenshotDir;
std::string serverName;
short serverPort;
@@ -519,23 +520,24 @@ static void printHelp()
std::cout
<< _("mana") << endl << endl
<< _("Options:") << endl
- << _(" -C --config-file : Configuration file to use") << endl
- << _(" -d --data : Directory to load game data from") << endl
- << _(" -D --default : Choose default character server and "
- "character") << endl
- << _(" -h --help : Display this help") << endl
- << _(" -S --home-dir : Directory to use as home directory") << endl
- << _(" -H --update-host : Use this update host") << endl
- << _(" -P --password : Login with this password") << endl
- << _(" -c --character : Login with this character") << endl
- << _(" -p --port : Login server port") << endl
- << _(" -s --server : Login server name or IP") << endl
- << _(" -u --skip-update : Skip the update downloads") << endl
- << _(" -U --username : Login with this username") << endl
+ << _(" -C --config-file : Configuration file to use") << endl
+ << _(" -d --data : Directory to load game data from") << endl
+ << _(" -D --default : Choose default character server and "
+ "character") << endl
+ << _(" -h --help : Display this help") << endl
+ << _(" -S --home-dir : Directory to use as home directory") << endl
+ << _(" -i --screenshot-dir : Directory to store screenshots") << endl
+ << _(" -H --update-host : Use this update host") << endl
+ << _(" -P --password : Login with this password") << endl
+ << _(" -c --character : Login with this character") << endl
+ << _(" -p --port : Login server port") << endl
+ << _(" -s --server : Login server name or IP") << endl
+ << _(" -u --skip-update : Skip the update downloads") << endl
+ << _(" -U --username : Login with this username") << endl
#ifdef USE_OPENGL
- << _(" -O --no-opengl : Disable OpenGL for this session") << endl
+ << _(" -O --no-opengl : Disable OpenGL for this session") << endl
#endif
- << _(" -v --version : Display the version") << endl;
+ << _(" -v --version : Display the version") << endl;
}
static void printVersion()
@@ -545,23 +547,24 @@ static void printVersion()
static void parseOptions(int argc, char *argv[], Options &options)
{
- const char *optstring = "hvud:U:P:Dc:s:p:C:H:S:O";
+ const char *optstring = "hvud:U:P:Dc:s:p:C:H:S:Oi:";
const struct option long_options[] = {
- { "config-file", required_argument, 0, 'C' },
- { "data", required_argument, 0, 'd' },
- { "default", no_argument, 0, 'D' },
- { "password", required_argument, 0, 'P' },
- { "character", required_argument, 0, 'c' },
- { "help", no_argument, 0, 'h' },
- { "home-dir", required_argument, 0, 'S' },
- { "update-host", required_argument, 0, 'H' },
- { "port", required_argument, 0, 'p' },
- { "server", required_argument, 0, 's' },
- { "skip-update", no_argument, 0, 'u' },
- { "username", required_argument, 0, 'U' },
- { "no-opengl", no_argument, 0, 'O' },
- { "version", no_argument, 0, 'v' },
+ { "config-file", required_argument, 0, 'C' },
+ { "data", required_argument, 0, 'd' },
+ { "default", no_argument, 0, 'D' },
+ { "password", required_argument, 0, 'P' },
+ { "character", required_argument, 0, 'c' },
+ { "help", no_argument, 0, 'h' },
+ { "home-dir", required_argument, 0, 'S' },
+ { "update-host", required_argument, 0, 'H' },
+ { "port", required_argument, 0, 'p' },
+ { "server", required_argument, 0, 's' },
+ { "skip-update", no_argument, 0, 'u' },
+ { "username", required_argument, 0, 'U' },
+ { "no-opengl", no_argument, 0, 'O' },
+ { "version", no_argument, 0, 'v' },
+ { "screenshot-dir", required_argument, 0, 'i' },
{ 0 }
};
@@ -618,6 +621,9 @@ static void parseOptions(int argc, char *argv[], Options &options)
case 'O':
options.noOpenGL = true;
break;
+ case 'i':
+ options.screenshotDir = optarg;
+ break;
}
}
}
@@ -766,6 +772,8 @@ int main(int argc, char *argv[])
initHomeDir(options);
+ setScreenshotDir(options.screenshotDir);
+
// Configure logger
logger = new Logger;
logger->setLogFile(homeDir + std::string("/mana.log"));