Author: ilor
Date: Tue Oct 21 20:07:16 2008
New Revision: 30300

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30300&view=rev
Log:
windows: allow an absolute path passed in --config-dir to set the path without 
anything prepended to it

Modified:
    trunk/src/filesystem.cpp

Modified: trunk/src/filesystem.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/filesystem.cpp?rev=30300&r1=30299&r2=30300&view=diff
==============================================================================
--- trunk/src/filesystem.cpp (original)
+++ trunk/src/filesystem.cpp Tue Oct 21 20:07:16 2008
@@ -452,7 +452,12 @@
        const char* const appdata = getenv("APPDATA");
 #else
        const char* appdata = "";
-#endif
+#endif /*APPDATA_USERDATA*/
+       if (path.size() > 2 && path[1] == ':') {
+               //allow absolute path override 
+               game_config::preferences_dir = path;
+               return;
+       }       
        if (strlen(appdata) > 0)
        {
                if (path.empty())
@@ -465,7 +470,7 @@
                if (path.empty())
                {
                        path = "userdata";
-               }
+               }       
 #ifndef APPDATA_USERDATA
                else
                {
@@ -474,7 +479,7 @@
                        game_config::preferences_dir = appdata + 
std::string("/") + path;
                        return;
                }
-#endif
+#endif /*APPDATA_USERDATA*/
                char buf[512];
                const char* const res = getcwd(buf,sizeof(buf));
                if (res == NULL)
@@ -489,7 +494,7 @@
                }
        }
 
-#else
+#else /*_WIN32*/
        if (path.empty()) {
                path = PREFERENCES_DIR;
        }
@@ -511,7 +516,7 @@
        game_config::preferences_dir = home + path;
 #endif
 
-#endif
+#endif /*_WIN32*/
        user_data_dir = setup_user_data_dir();
 }
 
@@ -1017,7 +1022,9 @@
 
 scoped_istream::~scoped_istream()
 {
+       std::cerr << "deleting stream";
        delete stream;
+       std::cerr << " ok\n";
 }
 
 scoped_ostream& scoped_ostream::operator=(std::ostream *s)


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to