mail[Wesnoth-commits] r33405 - /trunk/src/addon_management.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by shadowm2006 on March 08, 2009 - 01:35:
Author: shadowmaster
Date: Sun Mar  8 01:35:27 2009
New Revision: 33405

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33405&view=rev
Log:
Detect early that an add-on's _info.cfg is missing instead of directly
trying to open a stream with it (which triggers spurious error
messages).

Modified:
    trunk/src/addon_management.cpp

Modified: trunk/src/addon_management.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/addon_management.cpp?rev=33405&r1=33404&r2=33405&view=diff
==============================================================================
--- trunk/src/addon_management.cpp (original)
+++ trunk/src/addon_management.cpp Sun Mar  8 01:35:27 2009
@@ -1223,20 +1223,23 @@
 
                config cfg;
                std::string const& addon = addons[i];
-               scoped_istream stream = istream_file(info_file);
-
-               read(cfg, *stream);
-
-               config const* const info_cfg = cfg.child("info");
-               if(info_cfg == NULL) {
-                       ++i;
-                       continue;
-               }
-               std::string const& version = (*info_cfg)["version"];
-               LOG_CFG << "caching add-on version info: " << addon << " [" 
<< version << "]\n";
-               version_info_cache.insert(std::make_pair(addon, 
version_info(version)));
-
                ++i;
+
+               if(file_exists(info_file)) {
+                       scoped_istream stream = istream_file(info_file);
+                       read(cfg, *stream);
+
+                       config const* const info_cfg = cfg.child("info");
+                       if(info_cfg == NULL) {
+                               continue;
+                       }
+                       std::string const& version = (*info_cfg)["version"];
+                       LOG_CFG << "caching add-on version info: " << addon 
<< " [" << version << "]\n";
+                       version_info_cache.insert(std::make_pair(addon, 
version_info(version)));
+               }
+               else {
+                       WRN_CFG << "add-on '" << addon << "' has no 
_info.cfg; cannot read version info\n";
+               }
        }
 }
 




Related Messages


Powered by MHonArc, Updated Sun Mar 08 06:20:24 2009