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_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 // pure virtual functions
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;    // Full pathname of the executable
00075         const std::string &getAppName() const;                  // install directory under progams/ ie "SecondLife"
00076         const std::string &getExecutableDir() const;    // Directory where the executable is located
00077         const std::string &getExecutableFilename() const;// Filename of .exe
00078         const std::string &getWorkingDir() const; // Current working directory
00079         const std::string &getAppRODataDir() const;     // Location of read-only data files
00080         const std::string &getOSUserDir() const;                // Location of the os-specific user dir
00081         const std::string &getOSUserAppDir() const;     // Location of the os-specific user app dir
00082         const std::string &getLindenUserDir() const;    // Location of the Linden user dir.
00083         const std::string &getChatLogsDir() const;      // Location of the chat logs dir.
00084         const std::string &getPerAccountChatLogsDir() const;    // Location of the per account chat logs dir.
00085         const std::string &getTempDir() const;                  // Common temporary directory
00086         const std::string  getCacheDir(bool get_default = false) const; // Location of the cache.
00087         const std::string &getCAFile() const;                   // File containing TLS certificate authorities
00088         const std::string &getDirDelimiter() const;     // directory separator for platform (ie. '\' or '/' or ':')
00089         const std::string &getSkinDir() const;          // User-specified skin folder.
00090 
00091         // Expanded filename
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         // random filename in common temporary directory
00096         std::string getTempFilename() const;
00097 
00098         virtual void setChatLogsDir(const std::string &path);           // Set the chat logs dir to this user's dir
00099         virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);               // Set the per user chat log directory.
00100         virtual void setLindenUserDir(const std::string &first, const std::string &last);               // Set the linden user dir to this user's dir
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;               // install directory under progams/ ie "SecondLife"   
00108         std::string mExecutablePathAndName; // full path + Filename of .exe
00109         std::string mExecutableFilename;    // Filename of .exe
00110         std::string mExecutableDir;              // Location of executable
00111         std::string mWorkingDir;                 // Current working directory
00112         std::string mAppRODataDir;                       // Location for static app data
00113         std::string mOSUserDir;                  // OS Specific user directory
00114         std::string mOSUserAppDir;                       // OS Specific user app directory
00115         std::string mLindenUserDir;              // Location for Linden user-specific data
00116         std::string mPerAccountChatLogsDir;              // Location for chat logs.
00117         std::string mChatLogsDir;                // Location for chat logs.
00118         std::string mCAFile;                             // Location of the TLS certificate authority PEM file.
00119         std::string mTempDir;
00120         std::string mCacheDir;
00121         std::string mDirDelimiter;
00122         std::string mSkinDir;                   // Location for u ser-specified skin info.
00123 };
00124 
00125 void dir_exists_or_crash(const std::string &dir_name);
00126 
00127 extern LLDir *gDirUtilp;
00128 
00129 #endif // LL_LLDIR_H

Generated on Thu Jul 1 06:08:24 2010 for Second Life Viewer by  doxygen 1.4.7