diff options
author | Max Horn | 2008-08-27 18:38:06 +0000 |
---|---|---|
committer | Max Horn | 2008-08-27 18:38:06 +0000 |
commit | 5860aa45b75c1680af509d797fac98fda939820e (patch) | |
tree | ebff4df84e2ce0f98d3b5f758acc542eb67c6596 /backends/fs/posix | |
parent | 44266bfc28e74befa962795807119f77e8054361 (diff) | |
download | scummvm-rg350-5860aa45b75c1680af509d797fac98fda939820e.tar.gz scummvm-rg350-5860aa45b75c1680af509d797fac98fda939820e.tar.bz2 scummvm-rg350-5860aa45b75c1680af509d797fac98fda939820e.zip |
Slightly modified form of patch #2043093: OS/2 patches for posix-fs
svn-id: r34193
Diffstat (limited to 'backends/fs/posix')
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 7036b025f2..efc75bc187 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -31,6 +31,13 @@ #include <dirent.h> #include <stdio.h> +#ifdef __OS2__ +#define INCL_DOS +#include <os2.h> +#endif + + + /** * Returns the last component of a given path. * @@ -109,6 +116,38 @@ AbstractFilesystemNode *POSIXFilesystemNode::getChild(const Common::String &n) c bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { assert(_isDirectory); +#ifdef __OS2__ + if (_path == "/") { + ULONG ulDrvNum; + ULONG ulDrvMap; + + DosQueryCurrentDisk(&ulDrvNum, &ulDrvMap); + + for (int i = 0; i < 26; i++) { + if (ulDrvMap & 1) { + char drive_root[4]; + + 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)); + } + + ulDrvMap >>= 1; + } + + return true; + } +#endif + DIR *dirp = opendir(_path.c_str()); struct dirent *dp; @@ -187,7 +226,12 @@ AbstractFilesystemNode *POSIXFilesystemNode::getParent() const { const char *start = _path.c_str(); const char *end = lastPathComponent(_path); - return new POSIXFilesystemNode(Common::String(start, end - start), true); +#ifdef __OS2__ + if (end == start) + return new POSIXFilesystemNode(); +#endif + + return new POSIXFilesystemNode(Common::String(start, end), true); } #endif //#if defined(UNIX) |