aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/posix
diff options
context:
space:
mode:
authorMax Horn2002-11-19 01:36:47 +0000
committerMax Horn2002-11-19 01:36:47 +0000
commitce3cde15a027fd092d0d27fa165f0166d4ecb927 (patch)
tree6da6d74fef1a1bf25b6380eed687f6fcc1f1068a /backends/fs/posix
parentf2007606a9155190ffe061dfde90fd1711ec73e8 (diff)
downloadscummvm-rg350-ce3cde15a027fd092d0d27fa165f0166d4ecb927.tar.gz
scummvm-rg350-ce3cde15a027fd092d0d27fa165f0166d4ecb927.tar.bz2
scummvm-rg350-ce3cde15a027fd092d0d27fa165f0166d4ecb927.zip
added some preliminary game auto detect code to the launcher; this required a small change to the FS API, Windows/Morphos code will have to be adapted slightly I fear. Also, not all games are detected correctly, and some probably never will be, so we still have to add a dialog for cases where auto detect doesn't work
svn-id: r5600
Diffstat (limited to 'backends/fs/posix')
-rw-r--r--backends/fs/posix/posix-fs.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 0ea131b3f9..5cdda13bc2 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -50,7 +50,7 @@ public:
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
- virtual FSList *listDir() const;
+ virtual FSList *listDir(ListMode mode = kListDirectoriesOnly) const;
virtual FilesystemNode *parent() const;
virtual FilesystemNode *clone() const { return new POSIXFilesystemNode(this); }
};
@@ -85,7 +85,7 @@ POSIXFilesystemNode::POSIXFilesystemNode(const POSIXFilesystemNode *node) {
_path = node->_path;
}
-FSList *POSIXFilesystemNode::listDir() const {
+FSList *POSIXFilesystemNode::listDir(ListMode mode) const {
assert(_isDirectory);
DIR *dirp = opendir(_path.c_str());
struct stat st;
@@ -109,8 +109,10 @@ FSList *POSIXFilesystemNode::listDir() const {
continue;
entry._isDirectory = S_ISDIR(st.st_mode);
- // FIXME - skip any non-directories for now
- if (!entry._isDirectory) continue;
+ // Honor the chosen mode
+ if ((mode == kListFilesOnly && entry._isDirectory) ||
+ (mode == kListDirectoriesOnly && !entry._isDirectory))
+ continue;
if (entry._isDirectory)
entry._path += "/";