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

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

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


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src filesystem.cpp
Date: Sat, 08 Jan 2005 09:49:48 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    05/01/08 14:18:35

Modified files:
        src            : filesystem.cpp 

Log message:
        also read zip files located in user dir; use logging system for 
zipios-related informational output

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

Patches:
Index: wesnoth/src/filesystem.cpp
diff -u wesnoth/src/filesystem.cpp:1.54 wesnoth/src/filesystem.cpp:1.55
--- wesnoth/src/filesystem.cpp:1.54     Sat Jan  8 11:25:41 2005
+++ wesnoth/src/filesystem.cpp  Sat Jan  8 14:18:35 2005
@@ -1,4 +1,4 @@
-/* $Id: filesystem.cpp,v 1.54 2005/01/08 11:25:41 ydirson Exp $ */
+/* $Id: filesystem.cpp,v 1.55 2005/01/08 14:18:35 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -59,9 +59,12 @@
 #include "config.hpp"
 #include "filesystem.hpp"
 #include "game_config.hpp"
+#include "log.hpp"
 #include "scoped_resource.hpp"
 #include "util.hpp"
 
+#define LOG_G lg::info(lg::general)
+
 #ifdef USE_ZIPIOS
 #include <sstream>
 #include <zipios++/collcoll.h>
@@ -73,25 +76,11 @@
 
 namespace {
        xzipios::XCColl the_collection;
-}
-#endif
 
-bool filesystem_init()
-{
-#ifdef USE_ZIPIOS
-       if (!get_user_data_dir().empty()) {
-               zipios::DirectoryCollection dir(get_user_data_dir());
-               std::cerr << "user collection has " << dir.size() << " 
elements\n";
-               the_collection.addCollection(dir);
-       }
-       if (!game_config::path.empty()) {
-               zipios::DirectoryCollection dir(game_config::path);
-               std::cerr << "system collection has " << dir.size() << " 
elements\n";
-               the_collection.addCollection(dir);
-# if 1
+       void register_zipdir(const std::string directory) {
                // look for zip files
-               zipios::DirectoryCollection dir2(game_config::path,false);
-               zipios::ConstEntries entries = dir2.entries();
+               zipios::DirectoryCollection dir(directory,false);
+               zipios::ConstEntries entries = dir.entries();
                for (zipios::ConstEntries::iterator i = entries.begin(); i != 
entries.end(); ++i) {
                        if ((**i).isValid()) {
                                const std::string fname = (**i).getName();
@@ -99,14 +88,31 @@
                                if (0 == fname.compare(fname.size() - 
suffix.size(), suffix.size(), suffix)) {
                                        zipios::ZipFile zip(game_config::path + 
"/" + fname);
                                        the_collection.addCollection(zip);
-                                       std::cerr << "zip collection " << fname 
<< 
+                                       LOG_G << "zip collection " << fname << 
                                                " has " << zip.size() << " 
elements\n";
                                }
-                               else std::cerr << "skipping non-zip " << fname 
<< "\n";
                        }
-                       else std::cerr << "skipping invalid entry\n";
+                       else LOG_G << "skipping invalid entry\n";
                }
-# endif
+               
+       }
+}
+#endif
+
+bool filesystem_init()
+{
+#ifdef USE_ZIPIOS
+       if (!get_user_data_dir().empty()) {
+               zipios::DirectoryCollection dir(get_user_data_dir());
+               LOG_G << "user collection has " << dir.size() << " elements\n";
+               the_collection.addCollection(dir);
+               register_zipdir(get_user_data_dir());
+       }
+       if (!game_config::path.empty()) {
+               zipios::DirectoryCollection dir(game_config::path);
+               LOG_G << "system collection has " << dir.size() << " 
elements\n";
+               the_collection.addCollection(dir);
+               register_zipdir(game_config::path);
        }
 #endif
        return true;
@@ -664,9 +670,9 @@
        if(checksum.nfiles == 0) {
                get_file_tree_checksum_internal("data/",checksum);
                get_file_tree_checksum_internal(get_user_data_dir() + 
"/data/",checksum);
-               std::cerr << "calculated data tree checksum: "
-                         << checksum.nfiles << " files; "
-                         << checksum.sum_size << " bytes\n";
+               LOG_G << "calculated data tree checksum: "
+                     << checksum.nfiles << " files; "
+                     << checksum.sum_size << " bytes\n";
        }
 
        return checksum;




reply via email to

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