aboutsummaryrefslogtreecommitdiff
path: root/backends/fs
diff options
context:
space:
mode:
authorLittleboy2011-06-28 01:57:21 -0400
committerLittleboy2011-06-28 01:58:09 -0400
commit2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f (patch)
tree961f9f72f30eb0c59f8dda644bed0d993abd8abf /backends/fs
parent4b51bef7aebaef1f2a0e8a901a0d7bd0fee15447 (diff)
downloadscummvm-rg350-2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f.tar.gz
scummvm-rg350-2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f.tar.bz2
scummvm-rg350-2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f.zip
BACKENDS: Update WindowsFilesystemNode::getChildren() to honor the hidden parameter (FR #1726611)
Hidden folders (such as the recycle bin or temporary hidden folders) will no longer be visible in the file/folder browser (as is the case on the Posix and related backends)
Diffstat (limited to 'backends/fs')
-rw-r--r--backends/fs/windows/windows-fs.cpp12
-rw-r--r--backends/fs/windows/windows-fs.h11
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.