From 3d980148f58c6f8fa530bd0d1216fb7bfc825054 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sat, 19 Apr 2008 23:20:03 +0000 Subject: Refix build for Unix. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4391 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/files.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/files.cc') 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 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 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 -- cgit v1.2.3-54-g00ecf