diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-15 11:26:00 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-15 11:26:00 +0000 |
commit | dd6871b0fbac350ea175d88e5b2bc340a5fb6e30 (patch) | |
tree | a5d03236d042f9c52c095304f74a323452d82778 /crawl-ref/source/chardump.cc | |
parent | 80ff6b26122857839ec18211fae01b734618fd34 (diff) | |
download | crawl-ref-dd6871b0fbac350ea175d88e5b2bc340a5fb6e30.tar.gz crawl-ref-dd6871b0fbac350ea175d88e5b2bc340a5fb6e30.zip |
Added -morgue option to specify where morgues are saved.
Added -macro option to specify location of macro file.
Morgue files are named morgue-<cname>-<time>.txt, provided Crawl is compiled without SHORT_FILE_NAMES.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@637 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/chardump.cc')
-rw-r--r-- | crawl-ref/source/chardump.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index 51e2dc6d59..e6396ba90d 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -958,6 +958,18 @@ const char *hunger_level(void) (you.hunger < 11000) ? "full" : "completely stuffed"); } +static std::string morgue_directory() +{ + std::string dir = + !SysEnv.morgue_dir.empty()? SysEnv.morgue_dir : + SysEnv.crawl_dir ? SysEnv.crawl_dir : ""; + + if (!dir.empty() && !dir[dir.length() - 1] == FILE_SEPARATOR) + dir += FILE_SEPARATOR; + + return (dir); +} + static bool write_dump( const std::string &fname, const std::string &text, @@ -965,9 +977,7 @@ static bool write_dump( { bool succeeded = false; - std::string file_name; - if (SysEnv.crawl_dir) - file_name += SysEnv.crawl_dir; + std::string file_name = morgue_directory(); file_name += strip_filename_unsafe_chars(fname); |