[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src filesystem.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src filesystem.cpp |
Date: |
Sun, 05 Sep 2004 06:21:53 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/09/05 10:16:28
Modified files:
src : filesystem.cpp
Log message:
Fix directory handling to workaround Reiser4 "feature". See bug 10264.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filesystem.cpp.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
Patches:
Index: wesnoth/src/filesystem.cpp
diff -u wesnoth/src/filesystem.cpp:1.40 wesnoth/src/filesystem.cpp:1.41
--- wesnoth/src/filesystem.cpp:1.40 Fri Sep 3 17:19:03 2004
+++ wesnoth/src/filesystem.cpp Sun Sep 5 10:16:28 2004
@@ -1,4 +1,4 @@
-/* $Id: filesystem.cpp,v 1.40 2004/09/03 17:19:03 ydirson Exp $ */
+/* $Id: filesystem.cpp,v 1.41 2004/09/05 10:16:28 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -131,21 +131,23 @@
const std::string name((directory + "/") + entry->d_name);
- //try to open it as a directory to test if it is a directory
- DIR* const temp_dir = opendir(name.c_str());
- if(temp_dir != NULL) {
- closedir(temp_dir);
- if(dirs != NULL) {
- if(mode == ENTIRE_FILE_PATH)
- dirs->push_back(name);
- else
- dirs->push_back(entry->d_name);
+ struct stat st;
+ if (::stat(name.c_str(), &st) != -1) {
+ if (S_ISREG(st.st_mode)) {
+ if (files != NULL) {
+ if (mode == ENTIRE_FILE_PATH)
+ files->push_back(name);
+ else
+ files->push_back(entry->d_name);
+ }
+ } else if (S_ISDIR(st.st_mode)) {
+ if (dirs != NULL) {
+ if (mode == ENTIRE_FILE_PATH)
+ dirs->push_back(name);
+ else
+ dirs->push_back(entry->d_name);
+ }
}
- } else if(files != NULL) {
- if(mode == ENTIRE_FILE_PATH)
- files->push_back(name);
- else
- files->push_back(entry->d_name);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src filesystem.cpp,
Guillaume Melquiond <=