mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
implemented parent() for POSIX fs code; added .cvsignore files
svn-id: r5571
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.deps
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* Implementation of the ScummVM file system API based on POSIX.
|
||||
@@ -119,9 +120,33 @@ FSList *POSIXFilesystemNode::listDir() 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 {
|
||||
// TODO !!!
|
||||
return 0;
|
||||
|
||||
POSIXFilesystemNode *p = new POSIXFilesystemNode();
|
||||
|
||||
// Root node is its own parent. Still we can't just return this
|
||||
// as the GUI code will call delete on the old node.
|
||||
if (_path != "/") {
|
||||
const char *start = _path.c_str();
|
||||
const char *end = lastPathComponent(_path);
|
||||
|
||||
p->_path = String(start, end - start);
|
||||
p->_isValid = true;
|
||||
p->_isDirectory = true;
|
||||
p->_displayName = lastPathComponent(p->_path);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif // defined(UNIX)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.deps
|
||||
Reference in New Issue
Block a user