Some tweaks to help (?) OS/2

svn-id: r34368
This commit is contained in:
Max Horn 2008-09-05 20:42:41 +00:00
parent 0dcb30e75c
commit e994723e7c
2 changed files with 20 additions and 14 deletions

View file

@ -117,20 +117,15 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
for (int i = 0; i < 26; i++) { for (int i = 0; i < 26; i++) {
if (ulDrvMap & 1) { if (ulDrvMap & 1) {
char drive_root[4]; char *drive_root = "A:";
drive_root[0] += i;
drive_root[0] = i + 'A'; POSIXFilesystemNode *entry = new POSIXFilesystemNode();
drive_root[1] = ':'; entry->_isDirectory = true;
drive_root[2] = '/'; entry->_isValid = true;
drive_root[3] = 0; entry->_path = drive_root;
entry->_displayName = "[" + entry->_path + "]";
POSIXFilesystemNode entry; myList.push_back(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; 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 // Start with a clone of this node, with the correct path set
POSIXFilesystemNode entry(*this); POSIXFilesystemNode entry(*this);
entry._displayName = dp->d_name; entry._displayName = dp->d_name;
if (_path != "/") if (_path.lastChar() != '/')
entry._path += '/'; entry._path += '/';
entry._path += entry._displayName; entry._path += entry._displayName;
@ -212,6 +207,12 @@ AbstractFilesystemNode *POSIXFilesystemNode::getParent() const {
if (_path == "/") if (_path == "/")
return 0; // The filesystem root has no parent 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 *start = _path.c_str();
const char *end = start + _path.size(); const char *end = start + _path.size();

View file

@ -47,6 +47,11 @@ protected:
virtual AbstractFilesystemNode *makeNode(const Common::String &path) const { virtual AbstractFilesystemNode *makeNode(const Common::String &path) const {
return new POSIXFilesystemNode(path); return new POSIXFilesystemNode(path);
} }
/**
* Plain constructor, for internal use only (hence protected).
*/
POSIXFilesystemNode() : _isDirectory(false), _isValid(false) {}
public: public:
/** /**