From 7d53ee933c4ac75f94e3edc65128e09953e3cdde Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 28 Oct 2010 16:29:21 -0400 Subject: STORM-477 add unit test for LLDir::getNetFileInDir --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'indra/llvfs/lldir.h') diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 4f63c04aab..0730b0fa79 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -74,7 +74,23 @@ class LLDir // pure virtual functions virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; - virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) = 0; + + /// Walk the files in a directory, with file pattern matching + virtual BOOL getNextFileInDir(const std::string &dirname, ///< directory path - must end in trailing slash! + const std::string &mask, ///< file pattern string (use "*" for all) + std::string &fname, ///< found file name + BOOL wrap ///< DEPRECATED - set to FALSE + ) = 0; + /**< + * @returns true if a file was found, false if the entire directory has been scanned. + * + * @note that this function is NOT thread safe + * + * This function may not be used to scan part of a directory, then start a new search of a different + * directory, and then restart the first search where it left off. + * + * @todo this really should be rewritten as an iterator object. + */ virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0; virtual std::string getCurPath() = 0; virtual BOOL fileExists(const std::string &filename) const = 0; -- cgit v1.2.3 From 4fa6500b5107f9d300a6ab7b6f011fb19621b05c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 28 Oct 2010 18:09:09 -0400 Subject: STORM-480 remove unused "wrap" parameter from LLDir::getNetFileInDir --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llvfs/lldir.h') diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 0730b0fa79..643b89199b 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -78,8 +78,7 @@ class LLDir /// Walk the files in a directory, with file pattern matching virtual BOOL getNextFileInDir(const std::string &dirname, ///< directory path - must end in trailing slash! const std::string &mask, ///< file pattern string (use "*" for all) - std::string &fname, ///< found file name - BOOL wrap ///< DEPRECATED - set to FALSE + std::string &fname ///< found file name ) = 0; /**< * @returns true if a file was found, false if the entire directory has been scanned. -- cgit v1.2.3 From 330978decd15e02d7cd23dcead52dc2373d7e5d5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 28 Oct 2010 22:40:37 -0400 Subject: STORM-480 remove (unused) LLDir::getRandomFileInDir --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llvfs/lldir.h') diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 643b89199b..71743d960c 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -90,7 +90,7 @@ class LLDir * * @todo this really should be rewritten as an iterator object. */ - virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0; + virtual std::string getCurPath() = 0; virtual BOOL fileExists(const std::string &filename) const = 0; -- cgit v1.2.3 From 2ab60cd988eba05ad6a3cfadb89c2cc5018f5885 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 29 Oct 2010 16:52:54 -0400 Subject: factor directory scanning and results check out, and add some more tests for getNextFileInDir --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llvfs/lldir.h') diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 71743d960c..883e87a8fd 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -87,7 +87,10 @@ class LLDir * * This function may not be used to scan part of a directory, then start a new search of a different * directory, and then restart the first search where it left off. - * + * @bug: this is known to fail at least on MacOS with patterns that have both: + * a wildcard left of the . and more than one sequential ? right of the . + * the pattern foo.??x appears to work + * but *.??x or foo?.??x do not * @todo this really should be rewritten as an iterator object. */ -- cgit v1.2.3 From 96112dfa2628569dea42bcf968eb7566d97e85f7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 3 Nov 2010 13:33:29 -0400 Subject: STORM-477: fixed getNextFileInDir on Windows7, improved test cases and documentation --HG-- branch : storm-102 --- indra/llvfs/lldir.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'indra/llvfs/lldir.h') diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 883e87a8fd..42996fd051 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -76,9 +76,9 @@ class LLDir virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; /// Walk the files in a directory, with file pattern matching - virtual BOOL getNextFileInDir(const std::string &dirname, ///< directory path - must end in trailing slash! - const std::string &mask, ///< file pattern string (use "*" for all) - std::string &fname ///< found file name + virtual BOOL getNextFileInDir(const std::string& dirname, ///< directory path - must end in trailing slash! + const std::string& mask, ///< file pattern string (use "*" for all) + std::string& fname ///< output: found file name ) = 0; /**< * @returns true if a file was found, false if the entire directory has been scanned. @@ -86,12 +86,18 @@ class LLDir * @note that this function is NOT thread safe * * This function may not be used to scan part of a directory, then start a new search of a different - * directory, and then restart the first search where it left off. - * @bug: this is known to fail at least on MacOS with patterns that have both: - * a wildcard left of the . and more than one sequential ? right of the . + * directory, and then restart the first search where it left off; the entire search must run to + * completion or be abandoned - there is no restart. + * + * @bug: See http://jira.secondlife.com/browse/VWR-23697 + * and/or the tests in test/lldir_test.cpp + * This is known to fail with patterns that have both: + * a wildcard left of a . and more than one sequential ? right of a . * the pattern foo.??x appears to work * but *.??x or foo?.??x do not - * @todo this really should be rewritten as an iterator object. + * + * @todo this really should be rewritten as an iterator object, and the + * filtering should be done in a platform-independent way. */ virtual std::string getCurPath() = 0; -- cgit v1.2.3