diff options
author | Nicolas Bacca | 2002-11-19 08:25:22 +0000 |
---|---|---|
committer | Nicolas Bacca | 2002-11-19 08:25:22 +0000 |
commit | 28080b27df558814d8a923fa00775ece318c8932 (patch) | |
tree | ac80ea98e8c500ee225a547bbcc6c2ebc222b021 /backends | |
parent | f7b8728aedbf4a027de16d2b7059835cda880d65 (diff) | |
download | scummvm-rg350-28080b27df558814d8a923fa00775ece318c8932.tar.gz scummvm-rg350-28080b27df558814d8a923fa00775ece318c8932.tar.bz2 scummvm-rg350-28080b27df558814d8a923fa00775ece318c8932.zip |
Update listDir
svn-id: r5613
Diffstat (limited to 'backends')
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index f5b2cfa25d..b340749fc8 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -50,14 +50,14 @@ public: virtual bool isDirectory() const { return _isDirectory; } virtual String path() const { return _path; } - virtual FSList *listDir() const; + virtual FSList *listDir(ListMode) const; virtual FilesystemNode *parent() const; virtual FilesystemNode *clone() const { return new WindowsFilesystemNode(this); } private: static char *toAscii(TCHAR *x); static TCHAR* toUnicode(char *x); - static void addFile (FSList* list, const WindowsFilesystemNode *parentNode, const char *base, WIN32_FIND_DATA* find_data); + static void addFile (FSList* list, ListMode mode, const WindowsFilesystemNode *parentNode, const char *base, WIN32_FIND_DATA* find_data); }; @@ -83,7 +83,7 @@ static TCHAR unicodeString[MAX_PATH]; #endif } -void WindowsFilesystemNode::addFile (FSList* list, const WindowsFilesystemNode *parentNode, const char *base, WIN32_FIND_DATA* find_data) { +void WindowsFilesystemNode::addFile (FSList* list, ListMode mode, const WindowsFilesystemNode *parentNode, const char *base, WIN32_FIND_DATA* find_data) { WindowsFilesystemNode entry; char *asciiName = toAscii(find_data->cFileName); bool isDirectory; @@ -94,8 +94,8 @@ void WindowsFilesystemNode::addFile (FSList* list, const WindowsFilesystemNode * isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false); - // Only keep the directories for the moment (files already supported) - if (!isDirectory) + if ((!isDirectory && mode == kListDirectoriesOnly) || + (isDirectory && mode == kListFilesOnly)) return; entry._isDirectory = isDirectory; @@ -141,7 +141,7 @@ WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode *node) _parentNode = node->_parentNode; } -FSList *WindowsFilesystemNode::listDir() const { +FSList *WindowsFilesystemNode::listDir(ListMode mode) const { assert(_isDirectory); FSList *myList = new FSList(); @@ -179,9 +179,9 @@ FSList *WindowsFilesystemNode::listDir() const { handle = FindFirstFile(toUnicode(searchPath), &desc); if (handle == INVALID_HANDLE_VALUE) return myList; - addFile(myList, this, _path.c_str(), &desc); + addFile(myList, mode, this, _path.c_str(), &desc); while (FindNextFile(handle, &desc)) - addFile(myList, this, _path.c_str(), &desc); + addFile(myList, mode, this, _path.c_str(), &desc); FindClose(handle); } |