Removed dependency between CommandLineArguments and Physfs
authorIngo Ruhnke <grumbel@gmail.com>
Mon, 18 Aug 2014 08:10:14 +0000 (10:10 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Mon, 18 Aug 2014 08:10:14 +0000 (10:10 +0200)
src/supertux/command_line_arguments.cpp
src/supertux/command_line_arguments.hpp
src/supertux/main.cpp

index 3877b46..e5dc3a1 100644 (file)
@@ -65,7 +65,7 @@ CommandLineArguments::print_datadir()
 }
 
 void
-CommandLineArguments::print_help(const char* argv0)
+CommandLineArguments::print_help(const char* arg0)
 {
   std::string default_user_data_dir =
       std::string(PHYSFS_getUserDir()) + WRITEDIR_NAME;
@@ -97,10 +97,9 @@ CommandLineArguments::print_help(const char* argv0)
                  "\n"
                  "Environment variables:\n"
                  "  SUPERTUX2_USER_DIR           Directory for user data (savegames, etc.);\n"
-                 "                               default %s\n"
                  "\n"
                  ))
-            % argv0 % default_user_data_dir
+            % arg0
             << std::flush;
 }
 
index d1c254b..d47215c 100644 (file)
@@ -75,7 +75,7 @@ public:
 
   void parse_args(int argc, char** argv);
 
-  void print_help(const char* argv0);
+  void print_help(const char* arg0);
   void print_version();
   void print_datadir();
 
index d03c54a..8342e43 100644 (file)
@@ -368,10 +368,6 @@ Main::run(int argc, char** argv)
   {
     CommandLineArguments args;
 
-    // Do this before pre_parse_commandline, because --help now shows the
-    // default user data dir.
-    PhysfsSubsystem physfs_subsystem(argv[0]);
-
     try
     {
       args.parse_args(argc, argv);
@@ -383,6 +379,8 @@ Main::run(int argc, char** argv)
       return EXIT_FAILURE;
     }
 
+    PhysfsSubsystem physfs_subsystem(argv[0]);
+
     timelog("config");
     ConfigSubsystem config_subsystem;
     args.merge_into(*g_config);