diff options
author | Max Horn | 2003-03-25 12:14:14 +0000 |
---|---|---|
committer | Max Horn | 2003-03-25 12:14:14 +0000 |
commit | 76548862f9c95b5a78865004ca4c46bd275bdaaf (patch) | |
tree | a221a6b14d191254be779ff5a1308d87ca91791e /backends/fs/posix | |
parent | b25a47ffc5727cbb4828ea51294d4aa747b0cb40 (diff) | |
download | scummvm-rg350-76548862f9c95b5a78865004ca4c46bd275bdaaf.tar.gz scummvm-rg350-76548862f9c95b5a78865004ca4c46bd275bdaaf.tar.bz2 scummvm-rg350-76548862f9c95b5a78865004ca4c46bd275bdaaf.zip |
default to current directory (instead of FS root)
svn-id: r6858
Diffstat (limited to 'backends/fs/posix')
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 7c006bc44c..e77d024b3c 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -24,10 +24,12 @@ #ifdef MACOSX #include <sys/types.h> +#include <sys/param.h> #endif #include <sys/stat.h> #include <dirent.h> #include <stdio.h> +#include <unistd.h> #ifdef __GP32__ //ph0x FIXME: implement and move to portdefs.h #define opendir(x) (0) @@ -62,15 +64,35 @@ public: }; +static const char *lastPathComponent(const ScummVM::String &str) { + const char *start = str.c_str(); + const char *cur = start + str.size() - 2; + + while (cur > start && *cur != '/') { + --cur; + } + + return cur+1; +} + FilesystemNode *FilesystemNode::getRoot() { return new POSIXFilesystemNode(); } POSIXFilesystemNode::POSIXFilesystemNode() { - _displayName = "/"; +#if 1 + char buf[MAXPATHLEN]; + getwd(buf); + + _path = buf; + _displayName = lastPathComponent(_path); + _path += '/'; +#else + _path = "/"; + _displayName = _path; +#endif _isValid = true; _isDirectory = true; - _path = "/"; } /* @@ -129,17 +151,6 @@ FSList *POSIXFilesystemNode::listDir(ListMode mode) const { return myList; } -const char *lastPathComponent(const ScummVM::String &str) { - const char *start = str.c_str(); - const char *cur = start + str.size() - 2; - - while (cur > start && *cur != '/') { - --cur; - } - - return cur+1; -} - FilesystemNode *POSIXFilesystemNode::parent() const { POSIXFilesystemNode *p = new POSIXFilesystemNode(); |