aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/fs/posix/posix-fs.cpp8
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;