00001
00032 #ifndef LL_LLDIR_H
00033 #define LL_LLDIR_H
00034
00035 typedef enum ELLPath
00036 {
00037 LL_PATH_NONE = 0,
00038 LL_PATH_USER_SETTINGS = 1,
00039 LL_PATH_APP_SETTINGS = 2,
00040 LL_PATH_PER_SL_ACCOUNT = 3,
00041 LL_PATH_CACHE = 4,
00042 LL_PATH_CHARACTER = 5,
00043 LL_PATH_MOTIONS = 6,
00044 LL_PATH_HELP = 7,
00045 LL_PATH_LOGS = 8,
00046 LL_PATH_TEMP = 9,
00047 LL_PATH_SKINS = 10,
00048 LL_PATH_TOP_SKIN = 11,
00049 LL_PATH_CHAT_LOGS = 12,
00050 LL_PATH_PER_ACCOUNT_CHAT_LOGS = 13,
00051 LL_PATH_MOZILLA_PROFILE = 14,
00052 LL_PATH_COUNT = 15
00053 } ELLPath;
00054
00055
00056 class LLDir
00057 {
00058 public:
00059 LLDir();
00060 virtual ~LLDir();
00061
00062 virtual void initAppDirs(const std::string &app_name) = 0;
00063 public:
00064 virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask);
00065
00066
00067 virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0;
00068 virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) = 0;
00069 virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0;
00070 virtual std::string getCurPath() = 0;
00071 virtual BOOL fileExists(const std::string &filename) = 0;
00072
00073 const std::string findFile(const std::string &filename, const std::string searchPath1 = "", const std::string searchPath2 = "", const std::string searchPath3 = "");
00074 const std::string &getExecutablePathAndName() const;
00075 const std::string &getAppName() const;
00076 const std::string &getExecutableDir() const;
00077 const std::string &getExecutableFilename() const;
00078 const std::string &getWorkingDir() const;
00079 const std::string &getAppRODataDir() const;
00080 const std::string &getOSUserDir() const;
00081 const std::string &getOSUserAppDir() const;
00082 const std::string &getLindenUserDir() const;
00083 const std::string &getChatLogsDir() const;
00084 const std::string &getPerAccountChatLogsDir() const;
00085 const std::string &getTempDir() const;
00086 const std::string getCacheDir(bool get_default = false) const;
00087 const std::string &getCAFile() const;
00088 const std::string &getDirDelimiter() const;
00089 const std::string &getSkinDir() const;
00090
00091
00092 std::string getExpandedFilename(ELLPath location, const std::string &filename) const;
00093 std::string getExpandedFilename(ELLPath location, const std::string &subdir, const std::string &filename) const;
00094
00095
00096 std::string getTempFilename() const;
00097
00098 virtual void setChatLogsDir(const std::string &path);
00099 virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);
00100 virtual void setLindenUserDir(const std::string &first, const std::string &last);
00101 virtual void setSkinFolder(const std::string &skin_folder);
00102 virtual bool setCacheDir(const std::string &path);
00103
00104 virtual void dumpCurrentDirectories();
00105
00106 protected:
00107 std::string mAppName;
00108 std::string mExecutablePathAndName;
00109 std::string mExecutableFilename;
00110 std::string mExecutableDir;
00111 std::string mWorkingDir;
00112 std::string mAppRODataDir;
00113 std::string mOSUserDir;
00114 std::string mOSUserAppDir;
00115 std::string mLindenUserDir;
00116 std::string mPerAccountChatLogsDir;
00117 std::string mChatLogsDir;
00118 std::string mCAFile;
00119 std::string mTempDir;
00120 std::string mCacheDir;
00121 std::string mDirDelimiter;
00122 std::string mSkinDir;
00123 };
00124
00125 void dir_exists_or_crash(const std::string &dir_name);
00126
00127 extern LLDir *gDirUtilp;
00128
00129 #endif // LL_LLDIR_H