From 4b7d62bb60b9559290a67645368e2dd72865e173 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 14 Dec 2006 07:01:29 +0000 Subject: Removed SHORT_FILE_NAMES for Windows builds. Fixed poisoned needles not stacking correctly. Allow character names to end with digits on multiuser systems. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@628 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/files.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'crawl-ref/source/files.cc') diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 5653948834..757783a045 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -208,7 +208,7 @@ static std::string uid_as_string() { #ifdef MULTIUSER char struid[20]; - snprintf( struid, sizeof struid, "%d", (int)getuid() ); + snprintf( struid, sizeof struid, "-%d", (int)getuid() ); return std::string(struid); #else return std::string(); @@ -229,13 +229,7 @@ static bool is_uid_file(const std::string &name, const std::string &ext) std::string::size_type suffix_pos = name.find(save_suffix); return (suffix_pos != std::string::npos && suffix_pos == name.length() - save_suffix.length() - && suffix_pos != 0 -#ifdef MULTIUSER - // See verifyPlayerName() in newgame.cc - && !isdigit(name[suffix_pos - 1]) -#endif - ); - + && suffix_pos != 0); } bool is_save_file_name(const std::string &name) @@ -347,6 +341,10 @@ static bool create_dirs(const std::string &dir) path += segments[i]; path += FILE_SEPARATOR; + // Handle absolute paths correctly. + if (i == 0 && dir.size() && dir[0] == FILE_SEPARATOR) + path = FILE_SEPARATOR + path; + if (!dir_exists(path) && create_directory(path.c_str())) return (false); } -- cgit v1.2.3-54-g00ecf