lldir.h

Go to the documentation of this file.
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_HTML = 15,
00053         LL_PATH_COUNT = 16
00054 } ELLPath;
00055 
00056 
00057 class LLDir
00058 {
00059  public:
00060         LLDir();
00061         virtual ~LLDir();
00062 
00063         virtual void initAppDirs(const std::string &app_name) = 0;
00064  public:        
00065          virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask);
00066 
00067 // pure virtual functions
00068          virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0;
00069          virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) = 0;
00070          virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0;
00071         virtual std::string getCurPath() = 0;
00072         virtual BOOL fileExists(const std::string &filename) = 0;
00073 
00074         const std::string findFile(const std::string &filename, const std::string searchPath1 = "", const std::string searchPath2 = "", const std::string searchPath3 = "");
00075         const std::string &getExecutablePathAndName() const;    // Full pathname of the executable
00076         const std::string &getAppName() const;                  // install directory under progams/ ie "SecondLife"
00077         const std::string &getExecutableDir() const;    // Directory where the executable is located
00078         const std::string &getExecutableFilename() const;// Filename of .exe
00079         const std::string &getWorkingDir() const; // Current working directory
00080         const std::string &getAppRODataDir() const;     // Location of read-only data files
00081         const std::string &getOSUserDir() const;                // Location of the os-specific user dir
00082         const std::string &getOSUserAppDir() const;     // Location of the os-specific user app dir
00083         const std::string &getLindenUserDir() const;    // Location of the Linden user dir.
00084         const std::string &getChatLogsDir() const;      // Location of the chat logs dir.
00085         const std::string &getPerAccountChatLogsDir() const;    // Location of the per account chat logs dir.
00086         const std::string &getTempDir() const;                  // Common temporary directory
00087         const std::string  getCacheDir(bool get_default = false) const; // Location of the cache.
00088         const std::string &getCAFile() const;                   // File containing TLS certificate authorities
00089         const std::string &getDirDelimiter() const;     // directory separator for platform (ie. '\' or '/' or ':')
00090         const std::string &getSkinDir() const;          // User-specified skin folder.
00091 
00092         // Expanded filename
00093         std::string getExpandedFilename(ELLPath location, const std::string &filename) const;
00094         std::string getExpandedFilename(ELLPath location, const std::string &subdir, const std::string &filename) const;
00095 
00096         // random filename in common temporary directory
00097         std::string getTempFilename() const;
00098 
00099         virtual void setChatLogsDir(const std::string &path);           // Set the chat logs dir to this user's dir
00100         virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);               // Set the per user chat log directory.
00101         virtual void setLindenUserDir(const std::string &first, const std::string &last);               // Set the linden user dir to this user's dir
00102         virtual void setSkinFolder(const std::string &skin_folder);
00103         virtual bool setCacheDir(const std::string &path);
00104 
00105         virtual void dumpCurrentDirectories();
00106         
00107 protected:
00108         std::string mAppName;               // install directory under progams/ ie "SecondLife"   
00109         std::string mExecutablePathAndName; // full path + Filename of .exe
00110         std::string mExecutableFilename;    // Filename of .exe
00111         std::string mExecutableDir;              // Location of executable
00112         std::string mWorkingDir;                 // Current working directory
00113         std::string mAppRODataDir;                       // Location for static app data
00114         std::string mOSUserDir;                  // OS Specific user directory
00115         std::string mOSUserAppDir;                       // OS Specific user app directory
00116         std::string mLindenUserDir;              // Location for Linden user-specific data
00117         std::string mPerAccountChatLogsDir;              // Location for chat logs.
00118         std::string mChatLogsDir;                // Location for chat logs.
00119         std::string mCAFile;                             // Location of the TLS certificate authority PEM file.
00120         std::string mTempDir;
00121         std::string mCacheDir;
00122         std::string mDirDelimiter;
00123         std::string mSkinDir;                   // Location for u ser-specified skin info.
00124 };
00125 
00126 void dir_exists_or_crash(const std::string &dir_name);
00127 
00128 extern LLDir *gDirUtilp;
00129 
00130 #endif // LL_LLDIR_H

Generated on Fri May 16 08:33:01 2008 for SecondLife by  doxygen 1.5.5