aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix
diff options
context:
space:
mode:
authorMax Horn2008-09-17 18:26:44 +0000
committerMax Horn2008-09-17 18:26:44 +0000
commit468b387b9714f4a9ceea05b6ec505a66d67e1998 (patch)
tree91135bbb22495419f9bc96c69edf41e4b322aca7 /backends/fs/posix
parent977ee1fabc649d7cc46bc79f71bfe9399facaa35 (diff)
downloadscummvm-rg350-468b387b9714f4a9ceea05b6ec505a66d67e1998.tar.gz
scummvm-rg350-468b387b9714f4a9ceea05b6ec505a66d67e1998.tar.bz2
scummvm-rg350-468b387b9714f4a9ceea05b6ec505a66d67e1998.zip
Patch #2043093 (again - new patch): OS/2 patches for posix-fs
svn-id: r34595
Diffstat (limited to 'backends/fs/posix')
-rw-r--r--backends/fs/posix/posix-fs.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index dd11bc4d21..8dca78d82a 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -62,6 +62,11 @@ POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) {
_path = p;
}
+#ifdef __OS2__
+ // On OS/2, 'X:/' is a root of drive X, so we should not remove that last
+ // slash.
+ if (!(_path.size() == 3 && _path.hasSuffix(":/")))
+#endif
// Normalize the path (that is, remove unneeded slashes etc.)
_path = Common::normalizePath(_path, '/');
_displayName = Common::lastPathComponent(_path, '/');
@@ -97,7 +102,7 @@ AbstractFilesystemNode *POSIXFilesystemNode::getChild(const Common::String &n) c
// We assume here that _path is already normalized (hence don't bother to call
// Common::normalizePath on the final path).
Common::String newPath(_path);
- if (_path != "/")
+ if (_path.lastChar() != '/')
newPath += '/';
newPath += n;
@@ -117,14 +122,14 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
for (int i = 0; i < 26; i++) {
if (ulDrvMap & 1) {
- char *drive_root = "A:";
+ char drive_root[] = "A:/";
drive_root[0] += i;
POSIXFilesystemNode *entry = new POSIXFilesystemNode();
entry->_isDirectory = true;
entry->_isValid = true;
entry->_path = drive_root;
- entry->_displayName = "[" + entry->_path + "]";
+ entry->_displayName = "[" + Common::String(drive_root, 2) + "]";
myList.push_back(entry);
}