summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-22 12:26:53 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-22 12:26:53 +0000
commitabb8fd86e78c57461f6729faafec5ea35ccd18a9 (patch)
treec262a150967152852cb015ddcd12a08530aedf7f /crawl-ref/source/files.cc
parent609ccd171cbe8473c0a03c47392a12e72de2baaa (diff)
downloadcrawl-ref-abb8fd86e78c57461f6729faafec5ea35ccd18a9.tar.gz
crawl-ref-abb8fd86e78c57461f6729faafec5ea35ccd18a9.zip
Pull c_macro out of the code and into clua/macro.lua.
User-script dofile and loadfile check for "clua" anywhere in the file name and refuse to load the file in that case; only core Crawl code can load Lua files from clua/*. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1622 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 68dc9424b2..114a3f23a2 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -285,10 +285,14 @@ static bool create_dirs(const std::string &dir)
return (true);
}
-std::string datafile_path(const std::string &basename,
+std::string datafile_path(std::string basename,
bool croak_on_fail,
bool test_base_path)
{
+#if FILE_SEPARATOR != '/'
+ basename = replace_all_of(basename, "/", std::string(1, FILE_SEPARATOR));
+#endif
+
if (test_base_path && file_exists(basename))
return (basename);
@@ -305,7 +309,7 @@ std::string datafile_path(const std::string &basename,
const std::string prefixes[] = {
std::string("dat") + FILE_SEPARATOR,
std::string("docs") + FILE_SEPARATOR,
- std::string("..")+FILE_SEPARATOR+std::string("docs")+FILE_SEPARATOR,
+ std::string("..") + FILE_SEPARATOR + "docs" + FILE_SEPARATOR,
std::string("..") + FILE_SEPARATOR,
std::string(".") + FILE_SEPARATOR,
"",