[Scummvm-cvs-logs] SF.net SVN: scummvm: [27514] scummvm/branches/gsoc2007-fsnode
david_corrales at users.sourceforge.net
david_corrales at users.sourceforge.net
Sun Jun 17 19:17:39 CEST 2007
Revision: 27514
http://scummvm.svn.sourceforge.net/scummvm/?rev=27514&view=rev
Author: david_corrales
Date: 2007-06-17 10:17:38 -0700 (Sun, 17 Jun 2007)
Log Message:
-----------
Added a new parameter to the getChildren function, which allows including hidden files in the results.
Modified Paths:
--------------
scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h
scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs.cpp
scummvm/branches/gsoc2007-fsnode/common/fs.cpp
scummvm/branches/gsoc2007-fsnode/common/fs.h
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h 2007-06-17 16:21:05 UTC (rev 27513)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/abstract-fs.h 2007-06-17 17:17:38 UTC (rev 27514)
@@ -89,10 +89,11 @@
*
* @param list List to put the contents of the directory in.
* @param mode Mode to use while listing the directory.
+ * @param hidden Whether to include hidden files or not in the results.
*
* @return true if succesful, false otherwise (e.g. when the directory does not exist).
*/
- virtual bool getChildren(AbstractFSList &list, ListMode mode) const = 0;
+ virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const = 0;
/**
* Returns a human readable path string.
Modified: scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs.cpp 2007-06-17 16:21:05 UTC (rev 27513)
+++ scummvm/branches/gsoc2007-fsnode/backends/fs/posix/posix-fs.cpp 2007-06-17 17:17:38 UTC (rev 27514)
@@ -71,7 +71,7 @@
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
virtual AbstractFilesystemNode *getChild(const String &n) const;
- virtual bool getChildren(AbstractFSList &list, ListMode mode) const;
+ virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
virtual AbstractFilesystemNode *getParent() const;
private:
@@ -162,7 +162,7 @@
return new POSIXFilesystemNode(newPath, true);
}
-bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode) const {
+bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
assert(_isDirectory);
DIR *dirp = opendir(_path.c_str());
@@ -173,8 +173,8 @@
// loop over dir entries using readdir
while ((dp = readdir(dirp)) != NULL) {
- // Skip 'invisible' files
- if (dp->d_name[0] == '.')
+ // Skip 'invisible' files if necessary
+ if (dp->d_name[0] == '.' && !hidden)
continue;
String newPath(_path);
Modified: scummvm/branches/gsoc2007-fsnode/common/fs.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-06-17 16:21:05 UTC (rev 27513)
+++ scummvm/branches/gsoc2007-fsnode/common/fs.cpp 2007-06-17 17:17:38 UTC (rev 27514)
@@ -105,13 +105,13 @@
return FilesystemNode(node);
}
-bool FilesystemNode::getChildren(FSList &fslist, ListMode mode) const {
+bool FilesystemNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
if (!_realNode || !_realNode->isDirectory())
return false;
AbstractFSList tmp;
- if (!_realNode->getChildren(tmp, mode))
+ if (!_realNode->getChildren(tmp, mode, hidden))
return false;
fslist.clear();
Modified: scummvm/branches/gsoc2007-fsnode/common/fs.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/fs.h 2007-06-17 16:21:05 UTC (rev 27513)
+++ scummvm/branches/gsoc2007-fsnode/common/fs.h 2007-06-17 17:17:38 UTC (rev 27514)
@@ -67,7 +67,6 @@
private:
int *_refCount;
AbstractFilesystemNode *_realNode;
-
FilesystemNode(AbstractFilesystemNode *realNode);
public:
@@ -136,14 +135,14 @@
* that does not represent a directory, false is returned.
*
* @return true if succesful, false otherwise (e.g. when the directory does not exist).
- * @todo Rename this to listChildren or getChildren.
*/
- virtual bool getChildren(FSList &fslist, ListMode mode = kListDirectoriesOnly) const;
+ virtual bool getChildren(FSList &fslist, ListMode mode = kListDirectoriesOnly, bool hidden = false) const;
/**
* Return a human readable string for this node, usable for display (e.g.
* in the GUI code). Do *not* rely on it being usable for anything else,
* like constructing paths!
+ *
* @return the display name
*/
virtual Common::String getDisplayName() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list