aboutsummaryrefslogtreecommitdiff
path: root/backends/fs
diff options
context:
space:
mode:
authorChris Apers2006-04-11 18:13:04 +0000
committerChris Apers2006-04-11 18:13:04 +0000
commit4f28027c552cb2bee08a86b6cb8c368568bb876a (patch)
treeabe133dde49823953c2609559f5fb9ac262534dc /backends/fs
parentf6ae33b3d773d23b6f55ad0d150139960825a962 (diff)
downloadscummvm-rg350-4f28027c552cb2bee08a86b6cb8c368568bb876a.tar.gz
scummvm-rg350-4f28027c552cb2bee08a86b6cb8c368568bb876a.tar.bz2
scummvm-rg350-4f28027c552cb2bee08a86b6cb8c368568bb876a.zip
Fixed FS support based on lastest changes to the base fs class
svn-id: r21801
Diffstat (limited to 'backends/fs')
-rw-r--r--backends/fs/palmos/palmos-fs.cpp54
1 files changed, 40 insertions, 14 deletions
diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp
index a54f72d6c6..2cd2b283aa 100644
--- a/backends/fs/palmos/palmos-fs.cpp
+++ b/backends/fs/palmos/palmos-fs.cpp
@@ -22,7 +22,7 @@
#if defined(PALMOS_MODE)
#include "common/stdafx.h"
-#include "backends/fs/fs.h"
+#include "fs/fs.h"
#include <stdio.h>
#include <stdlib.h>
@@ -40,7 +40,8 @@ protected:
public:
PalmOSFilesystemNode();
- PalmOSFilesystemNode(const Char *path);
+ PalmOSFilesystemNode(const PalmOSFilesystemNode &node);
+ PalmOSFilesystemNode(const String &path);
virtual String displayName() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
@@ -54,17 +55,6 @@ private:
static void addFile (FSList &list, ListMode mode, const Char *base, FileInfoType* find_data);
};
-static const char *lastPathComponent(const Common::String &str) {
- const char *start = str.c_str();
- const char *cur = start + str.size() - 2;
-
- while (cur > start && *cur != '/') {
- --cur;
- }
-
- return cur + 1;
-}
-
void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base, FileInfoType* find_data) {
PalmOSFilesystemNode entry;
bool isDirectory;
@@ -91,6 +81,11 @@ AbstractFilesystemNode *FilesystemNode::getRoot() {
return new PalmOSFilesystemNode();
}
+AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) {
+ return new PalmOSFilesystemNode(path);
+}
+
+
PalmOSFilesystemNode::PalmOSFilesystemNode() {
_isDirectory = true;
_displayName = "Root";
@@ -99,8 +94,28 @@ PalmOSFilesystemNode::PalmOSFilesystemNode() {
_isPseudoRoot = true;
}
-FSList PalmOSFilesystemNode::listDir(ListMode mode) const {
+PalmOSFilesystemNode::PalmOSFilesystemNode(const String &path) {
+ if (path.size() == 0)
+ _isPseudoRoot = true;
+ _path = path;
+ const char *dsplName = NULL, *pos = path.c_str();
+ while (*pos)
+ if (*pos++ == '/')
+ dsplName = pos;
+ _displayName = String(dsplName);
+ _isValid = true;
+ _isDirectory = true;
+}
+
+PalmOSFilesystemNode::PalmOSFilesystemNode(const PalmOSFilesystemNode &node) {
+ _displayName = node._displayName;
+ _isDirectory = node._isDirectory;
+ _isValid = node._isValid;
+ _isPseudoRoot = node._isPseudoRoot;
+ _path = node._path;
+}
+FSList PalmOSFilesystemNode::listDir(ListMode mode) const {
FSList myList;
Err e;
Char nameP[256];
@@ -127,6 +142,17 @@ FSList PalmOSFilesystemNode::listDir(ListMode mode) const {
return myList;
}
+const char *lastPathComponent(const Common::String &str) {
+ const char *start = str.c_str();
+ const char *cur = start + str.size() - 2;
+
+ while (cur > start && *cur != '/') {
+ --cur;
+ }
+
+ return cur+1;
+}
+
AbstractFilesystemNode *PalmOSFilesystemNode::parent() const {
PalmOSFilesystemNode *p = 0;