[Scummvm-git-logs] scummvm master -> bfa1f392f744592ed24934a8900b5612f5886093

criezy criezy at scummvm.org
Sun Jul 14 23:11:37 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bfa1f392f7 POSIX: Fix missing expansion of "~" to home when it has no suffix


Commit: bfa1f392f744592ed24934a8900b5612f5886093
    https://github.com/scummvm/scummvm/commit/bfa1f392f744592ed24934a8900b5612f5886093
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-07-14T22:11:20+01:00

Commit Message:
POSIX: Fix missing expansion of "~" to home when it has no suffix

This fixes bug #10941: Tilde in save path creates "~" folder

Changed paths:
    backends/fs/posix/posix-fs.cpp


diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index c99505c..5b724c2 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;





More information about the Scummvm-git-logs mailing list