[Scummvm-cvs-logs] scummvm master -> 2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f

Littleboy littleboy22 at gmail.com
Tue Jun 28 08:14:17 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2d2ee68d2d BACKENDS: Update WindowsFilesystemNode::getChildren() to honor the hidden parameter (FR #1726611)


Commit: 2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f
    https://github.com/scummvm/scummvm/commit/2d2ee68d2d2b807d1adb7bdb30d5f174f775ca1f
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-06-27T22:58:09-07:00

Commit Message:
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)

Changed paths:
    backends/fs/windows/windows-fs.cpp
    backends/fs/windows/windows-fs.h



diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp
index 9e86475..c32ad2d 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 37d1e90..351307b 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.






More information about the Scummvm-git-logs mailing list