[Scummvm-cvs-logs] SF.net SVN: scummvm:[34368] scummvm/trunk/backends/fs/posix
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Sep 5 22:42:49 CEST 2008
Revision: 34368
http://scummvm.svn.sourceforge.net/scummvm/?rev=34368&view=rev
Author: fingolfin
Date: 2008-09-05 20:42:41 +0000 (Fri, 05 Sep 2008)
Log Message:
-----------
Some tweaks to help (?) OS/2
Modified Paths:
--------------
scummvm/trunk/backends/fs/posix/posix-fs.cpp
scummvm/trunk/backends/fs/posix/posix-fs.h
Modified: scummvm/trunk/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.cpp 2008-09-05 20:29:03 UTC (rev 34367)
+++ scummvm/trunk/backends/fs/posix/posix-fs.cpp 2008-09-05 20:42:41 UTC (rev 34368)
@@ -117,20 +117,15 @@
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 @@
// 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 @@
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();
Modified: scummvm/trunk/backends/fs/posix/posix-fs.h
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.h 2008-09-05 20:29:03 UTC (rev 34367)
+++ scummvm/trunk/backends/fs/posix/posix-fs.h 2008-09-05 20:42:41 UTC (rev 34368)
@@ -47,6 +47,11 @@
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:
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list