obscurestar avatar obscurestar committed 4ab73a1

Eliminated countFilesInDir boostified getCurPath for OSX

Comments (0)

Files changed (5)

indra/llvfs/lldir.h

 	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;
 

indra/llvfs/lldir_mac.cpp

 #include <sys/stat.h>
 #include <unistd.h>
 #include <glob.h>
+#include <boost/filesystem.hpp>
 
 #include <Carbon/Carbon.h>
 
 	//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;

indra/llvfs/lldir_mac.h

 		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();

indra/newview/tests/lldir_stub.cpp

 	/*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; }

indra/viewer_components/updater/tests/llupdaterservice_test.cpp

 {
 	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, 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.