diff options
author | Max Horn | 2008-09-05 20:42:41 +0000 |
---|---|---|
committer | Max Horn | 2008-09-05 20:42:41 +0000 |
commit | e994723e7c6f8c800bc9e9aea567cf9ebda1ed9d (patch) | |
tree | c53863d83f5c6ba15e22a1dadc0d9750481d71e0 /backends | |
parent | 0dcb30e75c79900d90874eb098fbec67ef0c703b (diff) | |
download | scummvm-rg350-e994723e7c6f8c800bc9e9aea567cf9ebda1ed9d.tar.gz scummvm-rg350-e994723e7c6f8c800bc9e9aea567cf9ebda1ed9d.tar.bz2 scummvm-rg350-e994723e7c6f8c800bc9e9aea567cf9ebda1ed9d.zip |
Some tweaks to help (?) OS/2
svn-id: r34368
Diffstat (limited to 'backends')
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 29 | ||||
-rw-r--r-- | backends/fs/posix/posix-fs.h | 5 |
2 files changed, 20 insertions, 14 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 688a7559b8..9a99b50503 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -117,20 +117,15 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo for (int i = 0; i < 26; i++) { if (ulDrvMap & 1) { - char drive_root[4]; + char *drive_root = "A:"; + drive_root[0] += i; - drive_root[0] = i + 'A'; - drive_root[1] = ':'; - drive_root[2] = '/'; - drive_root[3] = 0; - - POSIXFilesystemNode entry; - - entry._isDirectory = true; - entry._isValid = true; - entry._path = drive_root; - entry._displayName = "[" + Common::String(drive_root, 2) + "]"; - myList.push_back(new POSIXFilesystemNode(entry)); + POSIXFilesystemNode *entry = new POSIXFilesystemNode(); + entry->_isDirectory = true; + entry->_isValid = true; + entry->_path = drive_root; + entry->_displayName = "[" + entry->_path + "]"; + myList.push_back(entry); } ulDrvMap >>= 1; @@ -160,7 +155,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo // Start with a clone of this node, with the correct path set POSIXFilesystemNode entry(*this); entry._displayName = dp->d_name; - if (_path != "/") + if (_path.lastChar() != '/') entry._path += '/'; entry._path += entry._displayName; @@ -212,6 +207,12 @@ AbstractFilesystemNode *POSIXFilesystemNode::getParent() const { if (_path == "/") return 0; // The filesystem root has no parent +#ifdef __OS2__ + if (_path.size() == 3 && _path.hasSuffix(":/")) + // This is a root directory of a drive + return makeNode("/"); // return a virtual root for a list of drives +#endif + const char *start = _path.c_str(); const char *end = start + _path.size(); diff --git a/backends/fs/posix/posix-fs.h b/backends/fs/posix/posix-fs.h index 7d633a7fdf..e09e433e05 100644 --- a/backends/fs/posix/posix-fs.h +++ b/backends/fs/posix/posix-fs.h @@ -47,6 +47,11 @@ protected: virtual AbstractFilesystemNode *makeNode(const Common::String &path) const { return new POSIXFilesystemNode(path); } + + /** + * Plain constructor, for internal use only (hence protected). + */ + POSIXFilesystemNode() : _isDirectory(false), _isValid(false) {} public: /** |