diff options
| author | Thierry Crozat | 2019-07-14 22:09:34 +0100 | 
|---|---|---|
| committer | Thierry Crozat | 2019-07-14 22:11:20 +0100 | 
| commit | bfa1f392f744592ed24934a8900b5612f5886093 (patch) | |
| tree | 5dae4d843b6007aebb99df5e0e868fef80f9444c /backends/fs | |
| parent | 6694cdcd7389f7e5452733c8bfcfda9585223d3d (diff) | |
| download | scummvm-rg350-bfa1f392f744592ed24934a8900b5612f5886093.tar.gz scummvm-rg350-bfa1f392f744592ed24934a8900b5612f5886093.tar.bz2 scummvm-rg350-bfa1f392f744592ed24934a8900b5612f5886093.zip  | |
POSIX: Fix missing expansion of "~" to home when it has no suffix
This fixes bug #10941: Tilde in save path creates "~" folder
Diffstat (limited to 'backends/fs')
| -rw-r--r-- | backends/fs/posix/posix-fs.cpp | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index c99505cc4d..5b724c291f 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -91,13 +91,13 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) {  #endif  	// Expand "~/" to the value of the HOME env variable -	if (p.hasPrefix("~/")) { +	if (p.hasPrefix("~/") || p == "~") {  		const char *home = getenv("HOME");  		if (home != NULL && strlen(home) < MAXPATHLEN) {  			_path = home; -			// Skip over the tilda.  We know that p contains at least -			// two chars, so this is safe: -			_path += p.c_str() + 1; +			// Skip over the tilda. +			if (p.size() > 1) +				_path += p.c_str() + 1;  		}  	} else {  		_path = p;  | 
