summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-19 23:20:03 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-19 23:20:03 +0000
commit3d980148f58c6f8fa530bd0d1216fb7bfc825054 (patch)
treef385642ecd8fcffeb8bab1e790325f812406fc6f /crawl-ref/source/files.cc
parent9ba57ee3a6f72308ff01263dfe143cf23c1cf321 (diff)
downloadcrawl-ref-3d980148f58c6f8fa530bd0d1216fb7bfc825054.tar.gz
crawl-ref-3d980148f58c6f8fa530bd0d1216fb7bfc825054.zip
Refix build for Unix.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4391 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 7d04269590..d29964a2b7 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -226,7 +226,7 @@ player_save_info read_character_info(const std::string &savefile)
return fromfile;
}
-static bool _is_good_filename(const std::string &s)
+static inline bool _is_good_filename(const std::string &s)
{
return (s != "." && s != "..");
}
@@ -244,8 +244,11 @@ std::vector<std::string> get_dir_files(const std::string &dirname)
{
if (_is_good_filename(lData.cFileName))
files.push_back(lData.cFileName);
- while (FindNextFile(hFind, &lData))
- files.push_back(lData.cFileName);
+ while (FindNextFile(hFind, &lData))
+ {
+ if (_is_good_filename(lData.cFileName))
+ files.push_back(lData.cFileName);
+ }
FindClose(hFind);
}
#else // non-MS VC++ compilers
@@ -257,10 +260,8 @@ std::vector<std::string> get_dir_files(const std::string &dirname)
while (dirent *entry = readdir(dir))
{
std::string name = entry->d_name;
- if (name == "." || name == "..")
- continue;
-
- files.push_back(name);
+ if (_is_good_filename(name))
+ files.push_back(name);
}
closedir(dir);
#endif