diff options
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 12 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.h | 11 |
2 files changed, 13 insertions, 10 deletions
diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 9e864753c9..c32ad2da94 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -54,7 +54,7 @@ bool WindowsFilesystemNode::isWritable() const { return _access(_path.c_str(), W_OK) == 0; } -void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data) { +void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data) { WindowsFilesystemNode entry; char *asciiName = toAscii(find_data->cFileName); bool isDirectory; @@ -63,6 +63,10 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c if (!strcmp(asciiName, ".") || !strcmp(asciiName, "..")) return; + // Skip hidden files if asked + if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) && !hidden) + return; + isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false); if ((!isDirectory && mode == Common::FSNode::kListDirectoriesOnly) || @@ -163,8 +167,6 @@ AbstractFSNode *WindowsFilesystemNode::getChild(const Common::String &n) const { bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { assert(_isDirectory); - //TODO: honor the hidden flag - if (_isPseudoRoot) { #ifndef _WIN32_WCE // Drives enumeration @@ -200,10 +202,10 @@ bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if (handle == INVALID_HANDLE_VALUE) return false; - addFile(myList, mode, _path.c_str(), &desc); + addFile(myList, mode, _path.c_str(), hidden, &desc); while (FindNextFile(handle, &desc)) - addFile(myList, mode, _path.c_str(), &desc); + addFile(myList, mode, _path.c_str(), hidden, &desc); FindClose(handle); } diff --git a/backends/fs/windows/windows-fs.h b/backends/fs/windows/windows-fs.h index 37d1e9099b..351307bef0 100644 --- a/backends/fs/windows/windows-fs.h +++ b/backends/fs/windows/windows-fs.h @@ -93,12 +93,13 @@ private: * Adds a single WindowsFilesystemNode to a given list. * This method is used by getChildren() to populate the directory entries list. * - * @param list List to put the file entry node in. - * @param mode Mode to use while adding the file entry to the list. - * @param base Common::String with the directory being listed. - * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. + * @param list List to put the file entry node in. + * @param mode Mode to use while adding the file entry to the list. + * @param base Common::String with the directory being listed. + * @param hidden true if hidden files should be added, false otherwise + * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. */ - static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data); + static void addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data); /** * Converts a Unicode string to Ascii format. |