diff options
Diffstat (limited to 'linden/indra/llvfs')
-rw-r--r-- | linden/indra/llvfs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir.cpp | 9 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir.h | 8 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_linux.cpp | 45 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_linux.h | 3 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_mac.cpp | 15 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_mac.h | 3 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_solaris.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_win32.cpp | 15 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir_win32.h | 3 |
10 files changed, 97 insertions, 9 deletions
diff --git a/linden/indra/llvfs/CMakeLists.txt b/linden/indra/llvfs/CMakeLists.txt index cc0297e..25b57e0 100644 --- a/linden/indra/llvfs/CMakeLists.txt +++ b/linden/indra/llvfs/CMakeLists.txt | |||
@@ -4,7 +4,6 @@ project(llvfs) | |||
4 | 4 | ||
5 | include(00-Common) | 5 | include(00-Common) |
6 | include(LLCommon) | 6 | include(LLCommon) |
7 | include(UnixInstall) | ||
8 | 7 | ||
9 | include_directories( | 8 | include_directories( |
10 | ${LLCOMMON_INCLUDE_DIRS} | 9 | ${LLCOMMON_INCLUDE_DIRS} |
diff --git a/linden/indra/llvfs/lldir.cpp b/linden/indra/llvfs/lldir.cpp index 2c3c5f7..b8a4794 100644 --- a/linden/indra/llvfs/lldir.cpp +++ b/linden/indra/llvfs/lldir.cpp | |||
@@ -192,8 +192,9 @@ const std::string &LLDir::getOSUserAppDir() const | |||
192 | return mOSUserAppDir; | 192 | return mOSUserAppDir; |
193 | } | 193 | } |
194 | 194 | ||
195 | const std::string &LLDir::getLindenUserDir() const | 195 | const std::string &LLDir::getLindenUserDir(bool empty_ok) const |
196 | { | 196 | { |
197 | llassert(empty_ok || !mLindenUserDir.empty()); | ||
197 | return mLindenUserDir; | 198 | return mLindenUserDir; |
198 | } | 199 | } |
199 | 200 | ||
@@ -294,6 +295,10 @@ const std::string LLDir::getSkinBaseDir() const | |||
294 | return dir; | 295 | return dir; |
295 | } | 296 | } |
296 | 297 | ||
298 | const std::string &LLDir::getLLPluginDir() const | ||
299 | { | ||
300 | return mLLPluginDir; | ||
301 | } | ||
297 | 302 | ||
298 | std::string LLDir::getExpandedFilename(ELLPath location, const std::string& filename) const | 303 | std::string LLDir::getExpandedFilename(ELLPath location, const std::string& filename) const |
299 | { | 304 | { |
@@ -465,6 +470,8 @@ std::string LLDir::getDirName(const std::string& filepath) const | |||
465 | 470 | ||
466 | std::string LLDir::getExtension(const std::string& filepath) const | 471 | std::string LLDir::getExtension(const std::string& filepath) const |
467 | { | 472 | { |
473 | if (filepath.empty()) | ||
474 | return std::string(); | ||
468 | std::string basename = getBaseFileName(filepath, false); | 475 | std::string basename = getBaseFileName(filepath, false); |
469 | std::size_t offset = basename.find_last_of('.'); | 476 | std::size_t offset = basename.find_last_of('.'); |
470 | std::string exten = (offset == std::string::npos || offset == 0) ? "" : basename.substr(offset+1); | 477 | std::string exten = (offset == std::string::npos || offset == 0) ? "" : basename.substr(offset+1); |
diff --git a/linden/indra/llvfs/lldir.h b/linden/indra/llvfs/lldir.h index 21dcf5b..766f351 100644 --- a/linden/indra/llvfs/lldir.h +++ b/linden/indra/llvfs/lldir.h | |||
@@ -80,6 +80,10 @@ class LLDir | |||
80 | virtual BOOL fileExists(const std::string &filename) const = 0; | 80 | virtual BOOL fileExists(const std::string &filename) const = 0; |
81 | 81 | ||
82 | const std::string findFile(const std::string &filename, const std::string searchPath1 = "", const std::string searchPath2 = "", const std::string searchPath3 = "") const; | 82 | const std::string findFile(const std::string &filename, const std::string searchPath1 = "", const std::string searchPath2 = "", const std::string searchPath3 = "") const; |
83 | |||
84 | virtual std::string getLLPluginLauncher() = 0; // full path and name for the plugin shell | ||
85 | virtual std::string getLLPluginFilename(std::string base_name) = 0; // full path and name to the plugin DSO for this base_name (i.e. 'FOO' -> '/bar/baz/libFOO.so') | ||
86 | |||
83 | const std::string &getExecutablePathAndName() const; // Full pathname of the executable | 87 | const std::string &getExecutablePathAndName() const; // Full pathname of the executable |
84 | const std::string &getAppName() const; // install directory under progams/ ie "SecondLife" | 88 | const std::string &getAppName() const; // install directory under progams/ ie "SecondLife" |
85 | const std::string &getExecutableDir() const; // Directory where the executable is located | 89 | const std::string &getExecutableDir() const; // Directory where the executable is located |
@@ -88,7 +92,7 @@ class LLDir | |||
88 | const std::string &getAppRODataDir() const; // Location of read-only data files | 92 | const std::string &getAppRODataDir() const; // Location of read-only data files |
89 | const std::string &getOSUserDir() const; // Location of the os-specific user dir | 93 | const std::string &getOSUserDir() const; // Location of the os-specific user dir |
90 | const std::string &getOSUserAppDir() const; // Location of the os-specific user app dir | 94 | const std::string &getOSUserAppDir() const; // Location of the os-specific user app dir |
91 | const std::string &getLindenUserDir() const; // Location of the Linden user dir. | 95 | const std::string &getLindenUserDir(bool empty_ok = false) const; // Location of the Linden user dir. |
92 | const std::string &getChatLogsDir() const; // Location of the chat logs dir. | 96 | const std::string &getChatLogsDir() const; // Location of the chat logs dir. |
93 | const std::string &getPerAccountChatLogsDir() const; // Location of the per account chat logs dir. | 97 | const std::string &getPerAccountChatLogsDir() const; // Location of the per account chat logs dir. |
94 | const std::string &getTempDir() const; // Common temporary directory | 98 | const std::string &getTempDir() const; // Common temporary directory |
@@ -100,6 +104,7 @@ class LLDir | |||
100 | const std::string &getUserSkinDir() const; // User-specified skin folder with user modifications. e.g. c:\documents and settings\username\application data\second life\skins\curskin | 104 | const std::string &getUserSkinDir() const; // User-specified skin folder with user modifications. e.g. c:\documents and settings\username\application data\second life\skins\curskin |
101 | const std::string &getDefaultSkinDir() const; // folder for default skin. e.g. c:\program files\second life\skins\default | 105 | const std::string &getDefaultSkinDir() const; // folder for default skin. e.g. c:\program files\second life\skins\default |
102 | const std::string getSkinBaseDir() const; // folder that contains all installed skins (not user modifications). e.g. c:\program files\second life\skins | 106 | const std::string getSkinBaseDir() const; // folder that contains all installed skins (not user modifications). e.g. c:\program files\second life\skins |
107 | const std::string &getLLPluginDir() const; // Directory containing plugins and plugin shell | ||
103 | 108 | ||
104 | // Expanded filename | 109 | // Expanded filename |
105 | std::string getExpandedFilename(ELLPath location, const std::string &filename) const; | 110 | std::string getExpandedFilename(ELLPath location, const std::string &filename) const; |
@@ -156,6 +161,7 @@ protected: | |||
156 | std::string mSkinDir; // Location for current skin info. | 161 | std::string mSkinDir; // Location for current skin info. |
157 | std::string mDefaultSkinDir; // Location for default skin info. | 162 | std::string mDefaultSkinDir; // Location for default skin info. |
158 | std::string mUserSkinDir; // Location for user-modified skin info. | 163 | std::string mUserSkinDir; // Location for user-modified skin info. |
164 | std::string mLLPluginDir; // Location for plugins and plugin shell | ||
159 | }; | 165 | }; |
160 | 166 | ||
161 | void dir_exists_or_crash(const std::string &dir_name); | 167 | void dir_exists_or_crash(const std::string &dir_name); |
diff --git a/linden/indra/llvfs/lldir_linux.cpp b/linden/indra/llvfs/lldir_linux.cpp index 8ff8c5d..5f1eabb 100644 --- a/linden/indra/llvfs/lldir_linux.cpp +++ b/linden/indra/llvfs/lldir_linux.cpp | |||
@@ -94,14 +94,10 @@ LLDir_Linux::LLDir_Linux() | |||
94 | mExecutablePathAndName = ""; | 94 | mExecutablePathAndName = ""; |
95 | mExecutableDir = tmp_str; | 95 | mExecutableDir = tmp_str; |
96 | mWorkingDir = tmp_str; | 96 | mWorkingDir = tmp_str; |
97 | #ifdef APP_RO_DATA_DIR | ||
98 | mAppRODataDir = APP_RO_DATA_DIR; | ||
99 | #else | ||
100 | mAppRODataDir = tmp_str; | 97 | mAppRODataDir = tmp_str; |
101 | #endif | ||
102 | mOSUserDir = getCurrentUserHome(tmp_str); | 98 | mOSUserDir = getCurrentUserHome(tmp_str); |
103 | mOSUserAppDir = ""; | 99 | mOSUserAppDir = ""; |
104 | mLindenUserDir = tmp_str; | 100 | mLindenUserDir = ""; |
105 | 101 | ||
106 | char path [32]; /* Flawfinder: ignore */ | 102 | char path [32]; /* Flawfinder: ignore */ |
107 | 103 | ||
@@ -128,6 +124,33 @@ LLDir_Linux::LLDir_Linux() | |||
128 | } | 124 | } |
129 | } | 125 | } |
130 | 126 | ||
127 | mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin"; | ||
128 | |||
129 | #ifdef APP_RO_DATA_DIR | ||
130 | const char* appRODataDir = APP_RO_DATA_DIR; | ||
131 | if(appRODataDir[0] == '/') | ||
132 | { | ||
133 | // We have a full path to the data directory. | ||
134 | mAppRODataDir = appRODataDir; | ||
135 | } | ||
136 | else if(appRODataDir[0] != '\0') | ||
137 | { | ||
138 | // We have a relative path to the data directory. Search | ||
139 | // for it in each potential install prefix containing the | ||
140 | // executable. | ||
141 | for(std::string prefix = getDirName(mExecutableDir); | ||
142 | !prefix.empty(); prefix = getDirName(prefix)) | ||
143 | { | ||
144 | std::string dir = prefix + "/" + appRODataDir; | ||
145 | if(fileExists(dir + "/app_settings")) | ||
146 | { | ||
147 | mAppRODataDir = dir; | ||
148 | break; | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | #endif | ||
153 | |||
131 | // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. | 154 | // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. |
132 | mTempDir = "/tmp"; | 155 | mTempDir = "/tmp"; |
133 | } | 156 | } |
@@ -370,3 +393,15 @@ BOOL LLDir_Linux::fileExists(const std::string &filename) const | |||
370 | } | 393 | } |
371 | } | 394 | } |
372 | 395 | ||
396 | |||
397 | /*virtual*/ std::string LLDir_Linux::getLLPluginLauncher() | ||
398 | { | ||
399 | return gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + | ||
400 | "SLPlugin"; | ||
401 | } | ||
402 | |||
403 | /*virtual*/ std::string LLDir_Linux::getLLPluginFilename(std::string base_name) | ||
404 | { | ||
405 | return gDirUtilp->getLLPluginDir() + gDirUtilp->getDirDelimiter() + | ||
406 | "lib" + base_name + ".so"; | ||
407 | } | ||
diff --git a/linden/indra/llvfs/lldir_linux.h b/linden/indra/llvfs/lldir_linux.h index 20b408f..8e94fb1 100644 --- a/linden/indra/llvfs/lldir_linux.h +++ b/linden/indra/llvfs/lldir_linux.h | |||
@@ -52,6 +52,9 @@ public: | |||
52 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); | 52 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); |
53 | /*virtual*/ BOOL fileExists(const std::string &filename) const; | 53 | /*virtual*/ BOOL fileExists(const std::string &filename) const; |
54 | 54 | ||
55 | /*virtual*/ std::string getLLPluginLauncher(); | ||
56 | /*virtual*/ std::string getLLPluginFilename(std::string base_name); | ||
57 | |||
55 | private: | 58 | private: |
56 | DIR *mDirp; | 59 | DIR *mDirp; |
57 | int mCurrentDirIndex; | 60 | int mCurrentDirIndex; |
diff --git a/linden/indra/llvfs/lldir_mac.cpp b/linden/indra/llvfs/lldir_mac.cpp index b2d9787..29cac58 100644 --- a/linden/indra/llvfs/lldir_mac.cpp +++ b/linden/indra/llvfs/lldir_mac.cpp | |||
@@ -190,6 +190,8 @@ LLDir_Mac::LLDir_Mac() | |||
190 | } | 190 | } |
191 | 191 | ||
192 | mWorkingDir = getCurPath(); | 192 | mWorkingDir = getCurPath(); |
193 | |||
194 | mLLPluginDir = mAppRODataDir + mDirDelimiter + "llplugin"; | ||
193 | 195 | ||
194 | CFRelease(executableURLRef); | 196 | CFRelease(executableURLRef); |
195 | executableURLRef = NULL; | 197 | executableURLRef = NULL; |
@@ -388,4 +390,17 @@ BOOL LLDir_Mac::fileExists(const std::string &filename) const | |||
388 | } | 390 | } |
389 | 391 | ||
390 | 392 | ||
393 | /*virtual*/ std::string LLDir_Mac::getLLPluginLauncher() | ||
394 | { | ||
395 | return gDirUtilp->getAppRODataDir() + gDirUtilp->getDirDelimiter() + | ||
396 | "SLPlugin"; | ||
397 | } | ||
398 | |||
399 | /*virtual*/ std::string LLDir_Mac::getLLPluginFilename(std::string base_name) | ||
400 | { | ||
401 | return gDirUtilp->getLLPluginDir() + gDirUtilp->getDirDelimiter() + | ||
402 | base_name + ".dylib"; | ||
403 | } | ||
404 | |||
405 | |||
391 | #endif // LL_DARWIN | 406 | #endif // LL_DARWIN |
diff --git a/linden/indra/llvfs/lldir_mac.h b/linden/indra/llvfs/lldir_mac.h index 28d48a0..8be5d03 100644 --- a/linden/indra/llvfs/lldir_mac.h +++ b/linden/indra/llvfs/lldir_mac.h | |||
@@ -52,6 +52,9 @@ public: | |||
52 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &ask, std::string &fname); | 52 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &ask, std::string &fname); |
53 | virtual BOOL fileExists(const std::string &filename) const; | 53 | virtual BOOL fileExists(const std::string &filename) const; |
54 | 54 | ||
55 | /*virtual*/ std::string getLLPluginLauncher(); | ||
56 | /*virtual*/ std::string getLLPluginFilename(std::string base_name); | ||
57 | |||
55 | private: | 58 | private: |
56 | int mCurrentDirIndex; | 59 | int mCurrentDirIndex; |
57 | int mCurrentDirCount; | 60 | int mCurrentDirCount; |
diff --git a/linden/indra/llvfs/lldir_solaris.cpp b/linden/indra/llvfs/lldir_solaris.cpp index 9553d92..5132455 100644 --- a/linden/indra/llvfs/lldir_solaris.cpp +++ b/linden/indra/llvfs/lldir_solaris.cpp | |||
@@ -100,7 +100,7 @@ LLDir_Solaris::LLDir_Solaris() | |||
100 | mAppRODataDir = strdup(tmp_str); | 100 | mAppRODataDir = strdup(tmp_str); |
101 | mOSUserDir = getCurrentUserHome(tmp_str); | 101 | mOSUserDir = getCurrentUserHome(tmp_str); |
102 | mOSUserAppDir = ""; | 102 | mOSUserAppDir = ""; |
103 | mLindenUserDir = tmp_str; | 103 | mLindenUserDir = ""; |
104 | 104 | ||
105 | char path [LL_MAX_PATH]; /* Flawfinder: ignore */ | 105 | char path [LL_MAX_PATH]; /* Flawfinder: ignore */ |
106 | 106 | ||
@@ -161,6 +161,8 @@ LLDir_Solaris::LLDir_Solaris() | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin"; | ||
165 | |||
164 | // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. | 166 | // *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something. |
165 | mTempDir = "/tmp"; | 167 | mTempDir = "/tmp"; |
166 | } | 168 | } |
diff --git a/linden/indra/llvfs/lldir_win32.cpp b/linden/indra/llvfs/lldir_win32.cpp index 19b9bcc..9d4c5ec 100644 --- a/linden/indra/llvfs/lldir_win32.cpp +++ b/linden/indra/llvfs/lldir_win32.cpp | |||
@@ -143,6 +143,8 @@ LLDir_Win32::LLDir_Win32() | |||
143 | llwarns << "Couldn't create LL_PATH_CACHE dir " << mDefaultCacheDir << llendl; | 143 | llwarns << "Couldn't create LL_PATH_CACHE dir " << mDefaultCacheDir << llendl; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | |||
147 | mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin"; | ||
146 | } | 148 | } |
147 | 149 | ||
148 | LLDir_Win32::~LLDir_Win32() | 150 | LLDir_Win32::~LLDir_Win32() |
@@ -378,6 +380,19 @@ BOOL LLDir_Win32::fileExists(const std::string &filename) const | |||
378 | } | 380 | } |
379 | 381 | ||
380 | 382 | ||
383 | /*virtual*/ std::string LLDir_Win32::getLLPluginLauncher() | ||
384 | { | ||
385 | return gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + | ||
386 | "SLPlugin.exe"; | ||
387 | } | ||
388 | |||
389 | /*virtual*/ std::string LLDir_Win32::getLLPluginFilename(std::string base_name) | ||
390 | { | ||
391 | return gDirUtilp->getLLPluginDir() + gDirUtilp->getDirDelimiter() + | ||
392 | base_name + ".dll"; | ||
393 | } | ||
394 | |||
395 | |||
381 | #if 0 | 396 | #if 0 |
382 | // Utility function to get version number of a DLL | 397 | // Utility function to get version number of a DLL |
383 | 398 | ||
diff --git a/linden/indra/llvfs/lldir_win32.h b/linden/indra/llvfs/lldir_win32.h index 8710ca5..9ef4d30 100644 --- a/linden/indra/llvfs/lldir_win32.h +++ b/linden/indra/llvfs/lldir_win32.h | |||
@@ -49,6 +49,9 @@ public: | |||
49 | /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); | 49 | /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); |
50 | /*virtual*/ BOOL fileExists(const std::string &filename) const; | 50 | /*virtual*/ BOOL fileExists(const std::string &filename) const; |
51 | 51 | ||
52 | /*virtual*/ std::string getLLPluginLauncher(); | ||
53 | /*virtual*/ std::string getLLPluginFilename(std::string base_name); | ||
54 | |||
52 | private: | 55 | private: |
53 | BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname, BOOL wrap); | 56 | BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname, BOOL wrap); |
54 | 57 | ||