summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2009-09-24 20:18:07 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-09-24 20:27:06 +0530
commite65f11731155dec69701d806ba00c6bd24ffc33c (patch)
tree58d06a0b0b9d300ce3c6a59fec5ecd01ca8c7582 /crawl-ref/source/files.cc
parent383469b3ec04e7343eab5460e948f32b3857943a (diff)
downloadcrawl-ref-e65f11731155dec69701d806ba00c6bd24ffc33c.tar.gz
crawl-ref-e65f11731155dec69701d806ba00c6bd24ffc33c.zip
Set up a basic testing framework for LOS. ./crawl -test with a full debug build will run the test.
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index b5dc708b08..3650f8899d 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -225,7 +225,6 @@ bool get_dos_compatible_file_name(std::string *fname)
}
#endif
-
// Returns the names of all files in the given directory. Note that the
// filenames returned are relative to the directory.
std::vector<std::string> get_dir_files(const std::string &dirname)
@@ -268,6 +267,17 @@ std::vector<std::string> get_dir_files(const std::string &dirname)
return (files);
}
+std::vector<std::string> get_dir_files_ext(const std::string &dir,
+ const std::string &ext)
+{
+ const std::vector<std::string> allfiles(get_dir_files(dir));
+ std::vector<std::string> filtered;
+ for (int i = 0, size = allfiles.size(); i < size; ++i)
+ if (ends_with(allfiles[i], ext))
+ filtered.push_back(allfiles[i]);
+ return (filtered);
+}
+
std::string get_parent_directory(const std::string &filename)
{
std::string::size_type pos = filename.rfind(FILE_SEPARATOR);