X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fcommand_line_arguments.cpp;h=37a38107c1a54bf1b08678e718d058fea3b68428;hb=8a16f7745868e0969ead17fc6281e0788e37d1df;hp=20073762d3baa8b5250b52326ab8f99b9f3ee25b;hpb=0c45733f316acf677e95dbb0bd8a35a3c0f9523e;p=supertux.git diff --git a/src/supertux/command_line_arguments.cpp b/src/supertux/command_line_arguments.cpp index 20073762d..37a38107c 100644 --- a/src/supertux/command_line_arguments.cpp +++ b/src/supertux/command_line_arguments.cpp @@ -29,6 +29,8 @@ CommandLineArguments::CommandLineArguments() : m_action(NO_ACTION), m_log_level(LOG_WARNING), + datadir(), + userdir(), fullscreen_size(), fullscreen_refresh_rate(), window_size(), @@ -68,32 +70,45 @@ void CommandLineArguments::print_help(const char* arg0) { std::cerr << boost::format(_( + "Usage: %s [OPTIONS] [LEVELFILE]\n" "\n" - "Usage: %s [OPTIONS] [LEVELFILE]\n\n" - "CommandLineArguments:\n" + "General Options:\n" + " -h, --help Show this help message and quit\n" + " -v, --version Show SuperTux version and quit\n" " --verbose Print verbose messages\n" " --debug Print extra verbose messages\n" + " --print-datadir Print supertux's primary data directory.\n" + "\n" + "Video Options:\n" " -f, --fullscreen Run in fullscreen mode\n" " -w, --window Run in window mode\n" " -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n" " -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n" " -d, --default Reset video settings to default values\n" " --renderer RENDERER Use sdl, opengl, or auto to render\n" + "\n" + "Audio Options:\n" " --disable-sound Disable sound effects\n" " --disable-music Disable music\n" - " -h, --help Show this help message and quit\n" - " -v, --version Show SuperTux version and quit\n" + "\n" + "Game Options:\n" " --console Enable ingame scripting console\n" " --noconsole Disable ingame scripting console\n" " --show-fps Display framerate in levels\n" " --no-show-fps Do not display framerate in levels\n" + " -s, --debug-scripts Enable script debugger.\n" + "\n" + "Demo Recording Options:\n" " --record-demo FILE LEVEL Record a demo to FILE\n" " --play-demo FILE LEVEL Play a recorded demo\n" - " -s, --debug-scripts Enable script debugger.\n" - " --print-datadir Print supertux's primary data directory.\n" + "\n" + "Directory Options:\n" + " --datadir DIR Set the directory for the games datafiles\n" + " --userdir DIR Set the directory for user data (savegames, etc.)\n" "\n" "Environment variables:\n" - " SUPERTUX2_USER_DIR Directory for user data (savegames, etc.);\n" + " SUPERTUX2_USER_DIR Directory for user data (savegames, etc.)\n" + " SUPERTUX2_DATA_DIR Directory for the games datafiles\n" "\n" )) % arg0 @@ -137,6 +152,28 @@ CommandLineArguments::parse_args(int argc, char** argv) m_log_level = LOG_INFO; } } + else if (arg == "--datadir") + { + if (i+1 >= argc) + { + throw std::runtime_error("Need to specify a directory for --datadir"); + } + else + { + datadir = argv[++i]; + } + } + else if (arg == "--userdir") + { + if (i+1 >= argc) + { + throw std::runtime_error("Need to specify a directory for --userdir"); + } + else + { + userdir = argv[++i]; + } + } else if (arg == "--fullscreen" || arg == "-f") { use_fullscreen = true;