diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-10 08:32:25 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-10 08:32:25 +0000 |
commit | 16c8c1117fda477278eaf4983d93df1fa83e603a (patch) | |
tree | 5d4ce9f6f49c7a7881f776223cdc2bb114a898a9 /crawl-ref/source/files.cc | |
parent | 4ac70419ee6014d865b26f38d9c3a4fa08bdb2c2 (diff) | |
download | crawl-ref-16c8c1117fda477278eaf4983d93df1fa83e603a.tar.gz crawl-ref-16c8c1117fda477278eaf4983d93df1fa83e603a.zip |
Allow spaces, dashes and periods in character names.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@607 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r-- | crawl-ref/source/files.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 119068ecd0..1eba6f40c5 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -417,8 +417,8 @@ void check_savedir(std::string &dir) std::string sep = " "; sep[0] = FILE_SEPARATOR; - dir = replace_all(dir, "/", sep); - dir = replace_all(dir, "\\", sep); + dir = replace_all_of(dir, "/", sep); + dir = replace_all_of(dir, "\\", sep); // Suffix the separator if necessary if (dir[dir.length() - 1] != FILE_SEPARATOR) @@ -504,13 +504,15 @@ std::string get_savedir() return (dir.empty()? "." : dir); } -std::string get_savedir_filename(const char *prefix, const char *suffix, - const char *extension, bool suppress_uid) +std::string get_savedir_filename(const std::string &prefix, + const std::string &suffix, + const std::string &extension, + bool suppress_uid) { std::string result = Options.save_dir; // Shorten string as appropriate - result += std::string(prefix).substr(0, kFileNameLen); + result += strip_filename_unsafe_chars(prefix).substr(0, kFileNameLen); // Technically we should shorten the string first. But if // MULTIUSER is set we'll have long filenames anyway. Caveat @@ -520,7 +522,8 @@ std::string get_savedir_filename(const char *prefix, const char *suffix, result += suffix; - if ( *extension ) { + if (!extension.empty()) + { result += '.'; result += extension; } |