From ed4b37906749dd7ba2da56af741f2c0826f222d1 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Tue, 24 Jul 2012 12:11:20 -0700 Subject: Eliminated countFilesInDir boostified getCurPath for OSX --- indra/llvfs/lldir.h | 2 -- indra/llvfs/lldir_mac.cpp | 25 ++-------------------- indra/llvfs/lldir_mac.h | 1 - indra/newview/tests/lldir_stub.cpp | 1 - .../updater/tests/llupdaterservice_test.cpp | 4 ---- 5 files changed, 2 insertions(+), 31 deletions(-) diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 5ee8bdb542..a8b204e63e 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -73,8 +73,6 @@ class LLDir virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); // pure virtual functions - virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; - virtual std::string getCurPath() = 0; virtual BOOL fileExists(const std::string &filename) const = 0; diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 489bc3e4a7..f0b46ade6d 100644 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -239,34 +240,12 @@ void LLDir_Mac::initAppDirs(const std::string &app_name, //dumpCurrentDirectories(); } -U32 LLDir_Mac::countFilesInDir(const std::string &dirname, const std::string &mask) -{ - U32 file_count = 0; - glob_t g; - - std::string tmp_str; - tmp_str = dirname; - tmp_str += mask; - - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) - { - file_count = g.gl_pathc; - - globfree(&g); - } - - return (file_count); -} - std::string LLDir_Mac::getCurPath() { - char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - getcwd(tmp_str, LL_MAX_PATH); - return tmp_str; + return boost::filesystem::path( boost::filesystem::current_path() ).string(); } - BOOL LLDir_Mac::fileExists(const std::string &filename) const { struct stat stat_data; diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index d190d70be4..9f1938ae23 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -45,7 +45,6 @@ public: const std::string& app_read_only_data_dir); virtual std::string getCurPath(); - virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL fileExists(const std::string &filename) const; /*virtual*/ std::string getLLPluginLauncher(); diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp index 18cf4e7419..288541b4fd 100644 --- a/indra/newview/tests/lldir_stub.cpp +++ b/indra/newview/tests/lldir_stub.cpp @@ -45,7 +45,6 @@ public: /*virtual*/ void initAppDirs(const std::string &app_name) {} /*virtual*/ std::string getCurPath() { return "CUR_PATH_FROM_LLDIR"; } - /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; } /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; } /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; } /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; } diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index e19d5724f1..6f67fd0da0 100644 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -54,10 +54,6 @@ class LLDir_Mock : public LLDir { void initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir = "") {} - U32 countFilesInDir(const std::string &dirname, const std::string &mask) - { - return 0; - } void getRandomFileInDir(const std::string &dirname, const std::string &mask, -- cgit v1.2.3