wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src config.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src config.cpp
Date: Fri, 03 Sep 2004 19:53:50 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/09/03 23:48:44

Modified files:
        src            : config.cpp 

Log message:
        added new @ prefix to {inclusion} in config files to make it search 
both in the user's preferences dir and in the main data dir

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.104&tr2=1.105&r1=text&r2=text

Patches:
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.104 wesnoth/src/config.cpp:1.105
--- wesnoth/src/config.cpp:1.104        Fri Sep  3 21:05:36 2004
+++ wesnoth/src/config.cpp      Fri Sep  3 23:48:43 2004
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.104 2004/09/03 21:05:36 ydirson Exp $ */
+/* $Id: config.cpp,v 1.105 2004/09/03 23:48:43 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -310,13 +310,19 @@
                                std::string nfname;
 
                                //if the filename begins with a '~', then look
-                               //in the user's data directory
-                               if(newfilename != "" && newfilename[0] == '~') {
+                               //in the user's data directory. If the filename 
begins with
+                               //a '@' then we look in the user's data 
directory,
+                               //but default to the standard data directory if 
it's not found
+                               //there.
+                               if(newfilename != "" && (newfilename[0] == '~' 
|| newfilename[0] == '@')) {
                                        nfname = newfilename;
                                        prefix = get_user_data_dir() + "/";
                                        
nfname.erase(nfname.begin(),nfname.begin()+1);
                                        nfname = prefix + "data/" + nfname;
 
+                                       if(newfilename[0] == '@' && 
file_exists(nfname) == false && is_directory(nfname) == false) {
+                                               nfname = "data/" + 
newfilename.substr(1);
+                                       }
                                } else if(newfilename.size() >= 2 && 
newfilename[0] == '.' &&
                                                newfilename[1] == '/' ) {
                                        //if the filename begins with a "./", 
then look




reply via email to

[Prev in Thread] Current Thread [Next in Thread]