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: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src config.cpp
Date: Sat, 19 Feb 2005 18:40:07 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/02/19 23:40:07

Modified files:
        src            : config.cpp 

Log message:
        disable {~} and address@hidden when using zipios, they cause redundant 
reading of config files

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

Patches:
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.123 wesnoth/src/config.cpp:1.124
--- wesnoth/src/config.cpp:1.123        Fri Jan 28 20:17:46 2005
+++ wesnoth/src/config.cpp      Sat Feb 19 23:40:07 2005
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.123 2005/01/28 20:17:46 silene Exp $ */
+/* $Id: config.cpp,v 1.124 2005/02/19 23:40:07 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -206,37 +206,57 @@
                                std::string prefix;
                                std::string nfname;
 
-                               //if the filename begins with a '~', then look
-                               //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;
-                                       
nfname.erase(nfname.begin(),nfname.begin()+1);
-                                       nfname = get_user_data_dir() + "/data/" 
+ nfname;
+#ifdef USE_ZIPIOS
+                               if(newfilename != "" && newfilename[0] == '~') {
+                                       // I do not know of any valid use of 
{~xxx} when {xxx} is
+                                       // not used, and zipios takes care of 
both
+                                       LOG_CF << "ignoring reference to '" << 
newfilename << "'\n";
+                               } else
+#endif
+                               {
+#ifndef USE_ZIPIOS
+                                       //if the filename begins with a '~', 
then look
+                                       //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;
+                                               
nfname.erase(nfname.begin(),nfname.begin()+1);
+                                               nfname = get_user_data_dir() + 
"/data/" + nfname;
 
-                                       LOG_CF << "got relative name '" << 
newfilename << "' -> '" << nfname << "'\n";
+                                               LOG_CF << "got relative name '" 
<< newfilename << "' -> '" << nfname << "'\n";
 
-                                       if(newfilename[0] == '@' && 
file_exists(nfname) == false && is_directory(nfname) == false) {
-                                               nfname = "data/" + 
newfilename.substr(1);
-                                       }
-                               } else if(newfilename.size() >= 2 && 
newfilename[0] == '.' &&
+                                               if(newfilename[0] == '@' && 
file_exists(nfname) == false && is_directory(nfname) == false) {
+                                                       nfname = "data/" + 
newfilename.substr(1);
+                                               }
+                                       } else
+#endif
+                                       if(newfilename.size() >= 2 && 
newfilename[0] == '.' &&
                                                newfilename[1] == '/' ) {
-                                       //if the filename begins with a "./", 
then look
-                                       //in the same directory as the file 
currrently
-                                       //being preprocessed
-                                       nfname = newfilename;
-                                       
nfname.erase(nfname.begin(),nfname.begin()+2);
-                                       nfname = directory_name(fname) + nfname;
+                                               //if the filename begins with a 
"./", then look
+                                               //in the same directory as the 
file currrently
+                                               //being preprocessed
+                                               nfname = newfilename;
+                                               
nfname.erase(nfname.begin(),nfname.begin()+2);
+                                               nfname = directory_name(fname) 
+ nfname;
                                        
-                               } else {
-                                       nfname = "data/" + newfilename;
-                               }
+                                       } else {
+#ifdef USE_ZIPIOS
+                                               if(newfilename != "" && 
newfilename[0] == '@') {
+                                                       nfname = newfilename;
+                                                       
nfname.erase(nfname.begin(),nfname.begin()+1);
+                                                       nfname = "data/" + 
nfname;
+                                               } else
+#endif
 
-                               internal_preprocess_file(nfname,
-                                                      defines_map, depth+1,res,
-                                                      lines_src,line);
+                                                       nfname = "data/" + 
newfilename;
+                                       }
+
+                                       internal_preprocess_file(nfname,
+                                                                defines_map, 
depth+1,res,
+                                                                
lines_src,line);
+                               }
                        } else {
                                const std::string& str = read_file(newfilename);
                                res.insert(res.end(),str.begin(),str.end());




reply via email to

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