From e65f11731155dec69701d806ba00c6bd24ffc33c Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Thu, 24 Sep 2009 20:18:07 +0530 Subject: Set up a basic testing framework for LOS. ./crawl -test with a full debug build will run the test. --- crawl-ref/source/files.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/files.cc') 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 get_dir_files(const std::string &dirname) @@ -268,6 +267,17 @@ std::vector get_dir_files(const std::string &dirname) return (files); } +std::vector get_dir_files_ext(const std::string &dir, + const std::string &ext) +{ + const std::vector allfiles(get_dir_files(dir)); + std::vector 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); -- cgit v1.2.3-54-g00ecf