Commits

obscurestar committed 1d6470b

Reverted boost/cocoa changes to purely Mountain Lion fixes.

Comments (0)

Files changed (5)

indra/llvfs/lldir.h

-/** 
+/**  
  * @file lldir.h
  * @brief Definition of directory utilities class
  *
 	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

  * 
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
- */
+ */ 
 
 #if LL_DARWIN
 
 #include <sys/stat.h>
 #include <unistd.h>
 #include <glob.h>
-#include <boost/filesystem.hpp>
 
 #include <Carbon/Carbon.h>
-//#include "lldir_mac.mm"
-//
-//std::string getApplicationSupportFolder ()
-//{
-//    std::string support_folder_str;
-//    CFArrayRef a = appSupport();
-//    if (CFArrayGetCount(a) > 0) { 
-//        CFStringRef s = CFArrayGetValueAtIndex(a, 0);
-//        char path[PATH_MAX];
-//        CFStringGetFileSystemRepresentation(s, path, sizeof(path));
-//        support_folder_str = std::string(path);
-//    }
-//    CFRelease(a);
-//    return support_folder_str;
-//}
 
 // --------------------------------------------------------------------------------
 
 LLDir_Mac::LLDir_Mac()
 {
 	mDirDelimiter = "/";
+	mCurrentDirIndex = -1;
+	mCurrentDirCount = -1;
 	
 	CFBundleRef		mainBundleRef = NULL;
 	CFURLRef		executableURLRef = NULL;
 		mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins";
 	}
 	mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
+
+	//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()
 {
-    return boost::filesystem::path( boost::filesystem::current_path() ).string();
+	char tmp_str[LL_MAX_PATH];	/* Flawfinder: ignore */ 
+	getcwd(tmp_str, LL_MAX_PATH);
+	return tmp_str;
 }
 
 
+
 BOOL LLDir_Mac::fileExists(const std::string &filename) const
 {
-    return boost::filesystem::exists(filename);
+	struct stat stat_data;
+	// Check the age of the file
+	// Now, we see if the files we've gathered are recent...
+	int res = stat(filename.c_str(), &stat_data);
+	if (!res)
+	{
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
 }
 
 

indra/llvfs/lldir_mac.h

  * 
  * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
- */
+ */ 
 
 #if !LL_DARWIN
 #error This header must not be included when compiling for any target other than Mac OS. Consider including lldir.h instead.
 		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();
 	/*virtual*/ std::string getLLPluginFilename(std::string base_name);
+
+private:
+	int mCurrentDirIndex;
+	int mCurrentDirCount;
+	std::string mCurrentDir;
 };
 
 #endif // LL_LLDIR_MAC_H

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

-/**
+/** 
  * @file   llupdaterservice_test.cpp
  * @brief  Tests of llupdaterservice.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,