diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-26 15:30:07 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-26 15:30:07 +0000 |
commit | a844f8e10213c19b6e48d6ff98e97bc9f026a42a (patch) | |
tree | 9cada2344ca78a2c2de555dc8b7fa943ee7382fe /crawl-ref/source/files.h | |
parent | 1f1939b11a6ed95f769644c21e53589a1e7abeb9 (diff) | |
download | crawl-ref-a844f8e10213c19b6e48d6ff98e97bc9f026a42a.tar.gz crawl-ref-a844f8e10213c19b6e48d6ff98e97bc9f026a42a.zip |
Better support for settings files that include other files:
- Files can be included as "include foo" in .crawlrc instead of using
the Lua call: : crawl.read_options('foo'). include foo and the Lua
crawl.read_options('foo') are not equivalent - Lua only runs after the
start of a new game, which is too late for some option settings.
- Crawl searches for included files in this sequence:
- Absolute paths: use the path directly (but not if DATA_DIR_PATH is
set, since we don't want Crawl to read arbitrary files on
multiuser systems).
- Search relative to the including file.
- Search relative to any -rcdir(s) provided.
- Search in the data file search path.
- The data file search path now includes settings/ for when we move rc
stuff to settings/
.gitignore: ignore saves and morgue dirs correctly.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5256 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.h')
-rw-r--r-- | crawl-ref/source/files.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h index 830f99bc41..3e28c65a30 100644 --- a/crawl-ref/source/files.h +++ b/crawl-ref/source/files.h @@ -34,11 +34,23 @@ enum load_mode_type // referenced in files - newgame - ouch: extern FixedArray<bool, MAX_LEVELS, NUM_BRANCHES> tmp_file_pairs; +bool file_exists(const std::string &name); +bool dir_exists(const std::string &dir); +bool is_absolute_path(const std::string &path); +bool is_read_safe_path(const std::string &path); +void assert_read_safe_path(const std::string &path) throw (std::string); + std::string datafile_path(std::string basename, bool croak_on_fail = true, bool test_base_path = false); + std::string get_parent_directory(const std::string &filename); std::string get_base_filename(const std::string &filename); +std::string get_path_relative_to(const std::string &referencefile, + const std::string &relativepath); +std::string catpath(const std::string &first, const std::string &second); +std::string canonicalise_file_separator(const std::string &path); + bool check_dir(const std::string &what, std::string &dir, bool silent = false); bool travel_load_map( branch_type branch, int absdepth ); |