summaryrefslogtreecommitdiff
path: root/indra/llfilesystem
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llfilesystem')
-rw-r--r--indra/llfilesystem/CMakeLists.txt10
-rw-r--r--indra/llfilesystem/lldir.cpp8
-rw-r--r--indra/llfilesystem/lldir_linux.cpp12
-rw-r--r--indra/llfilesystem/lldir_linux.h2
-rw-r--r--indra/llfilesystem/lldir_mac.cpp2
-rw-r--r--indra/llfilesystem/lldiriterator.cpp8
-rw-r--r--indra/llfilesystem/lldiskcache.cpp31
7 files changed, 64 insertions, 9 deletions
diff --git a/indra/llfilesystem/CMakeLists.txt b/indra/llfilesystem/CMakeLists.txt
index 9f24f75eab..8d85f739b3 100644
--- a/indra/llfilesystem/CMakeLists.txt
+++ b/indra/llfilesystem/CMakeLists.txt
@@ -4,6 +4,9 @@ project(llfilesystem)
include(00-Common)
include(LLCommon)
+if (LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
+ include(UnixInstall)
+endif (LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
set(llfilesystem_SOURCE_FILES
lldir.cpp
@@ -30,17 +33,17 @@ if (DARWIN)
LIST(APPEND llfilesystem_HEADER_FILES lldir_mac.h)
endif (DARWIN)
-if (LINUX)
+if (LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
LIST(APPEND llfilesystem_SOURCE_FILES lldir_linux.cpp)
LIST(APPEND llfilesystem_HEADER_FILES lldir_linux.h)
if (INSTALL)
set_source_files_properties(lldir_linux.cpp
PROPERTIES COMPILE_FLAGS
- "-DAPP_RO_DATA_DIR=\\\"${APP_SHARE_DIR}\\\""
+ "-DAPP_RO_DATA_DIR=\\\"${APP_SHARE_DIR}\\\" -DAPP_LIBEXEC_DIR=\\\"${APP_LIBEXEC_DIR}\\\" -DAPP_PLUGIN_DIR=\\\"${INSTALL_LIBRARY_DIR}\\\""
)
endif (INSTALL)
-endif (LINUX)
+endif (LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
if (WINDOWS)
LIST(APPEND llfilesystem_SOURCE_FILES lldir_win32.cpp)
@@ -55,6 +58,7 @@ target_link_libraries(llfilesystem
llcommon
)
target_include_directories( llfilesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+include(LibraryInstall)
# Add tests
if (LL_TESTS)
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp
index 99d4850610..d12080aafa 100644
--- a/indra/llfilesystem/lldir.cpp
+++ b/indra/llfilesystem/lldir.cpp
@@ -121,7 +121,11 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
{
if (boost::filesystem::is_regular_file(dir_itr->status()))
{
+#if LL_WINDOWS
+ v.push_back(utf16str_to_utf8str(dir_itr->path().filename().wstring()));
+#else
v.push_back(dir_itr->path().filename().string());
+#endif
}
}
}
@@ -386,7 +390,7 @@ std::string LLDir::buildSLOSCacheDir() const
}
else
{
- res = add(getOSCacheDir(), "SecondLife");
+ res = add(getOSCacheDir(), "Megapahit");
}
return res;
}
@@ -690,7 +694,7 @@ void LLDir::walkSearchSkinDirs(const std::string& subdir,
const std::string& filename,
const FUNCTION& function) const
{
- for (const std::string& skindir : mSearchSkinDirs)
+ for (std::string skindir : mSearchSkinDirs)
{
std::string subdir_path(add(skindir, subdir));
for (const std::string& subsubdir : subsubdirs)
diff --git a/indra/llfilesystem/lldir_linux.cpp b/indra/llfilesystem/lldir_linux.cpp
index b13b42c954..69cfedebc7 100644
--- a/indra/llfilesystem/lldir_linux.cpp
+++ b/indra/llfilesystem/lldir_linux.cpp
@@ -83,7 +83,11 @@ LLDir_Linux::LLDir_Linux()
mExecutableFilename = "";
mExecutablePathAndName = "";
+#ifdef APP_LIBEXEC_DIR
+ mExecutableDir = APP_LIBEXEC_DIR;
+#else
mExecutableDir = tmp_str;
+#endif
mWorkingDir = tmp_str;
#ifdef APP_RO_DATA_DIR
mAppRODataDir = APP_RO_DATA_DIR;
@@ -123,7 +127,7 @@ LLDir_Linux::LLDir_Linux()
if ((path_end = strrchr(tmp_str,'/')))
{
*path_end = '\0';
- mExecutableDir = tmp_str;
+ //mExecutableDir = tmp_str;
mWorkingDir = tmp_str;
mExecutableFilename = path_end+1;
}
@@ -133,7 +137,11 @@ LLDir_Linux::LLDir_Linux()
}
}
+#ifdef APP_PLUGIN_DIR
+ mLLPluginDir = APP_PLUGIN_DIR;
+#else
mLLPluginDir = mExecutableDir + mDirDelimiter + "llplugin";
+#endif
// *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something.
mTempDir = "/tmp";
@@ -205,7 +213,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name,
LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL;
}
- mCAFile = getExpandedFilename(LL_PATH_EXECUTABLE, "ca-bundle.crt");
+ mCAFile = add(mAppRODataDir, "ca-bundle.crt");
}
U32 LLDir_Linux::countFilesInDir(const std::string &dirname, const std::string &mask)
diff --git a/indra/llfilesystem/lldir_linux.h b/indra/llfilesystem/lldir_linux.h
index bd031bd7bb..f9b0427ccd 100644
--- a/indra/llfilesystem/lldir_linux.h
+++ b/indra/llfilesystem/lldir_linux.h
@@ -24,7 +24,7 @@
* $/LicenseInfo$
*/
-#if !LL_LINUX
+#if !LL_LINUX && !__FreeBSD__
#error This header must not be included when compiling for any target other than Linux. Consider including lldir.h instead.
#endif // !LL_LINUX
diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp
index b9be75c528..b25c654e31 100644
--- a/indra/llfilesystem/lldir_mac.cpp
+++ b/indra/llfilesystem/lldir_mac.cpp
@@ -64,7 +64,7 @@ LLDir_Mac::LLDir_Mac()
{
mDirDelimiter = "/";
- const std::string secondLifeString = "SecondLife";
+ const std::string secondLifeString = "Megapahit";
std::string executablepathstr = getSystemExecutableFolder();
diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp
index 61f768c512..cd99c79357 100644
--- a/indra/llfilesystem/lldiriterator.cpp
+++ b/indra/llfilesystem/lldiriterator.cpp
@@ -72,7 +72,11 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
if (!is_dir)
{
+#if LL_WINDOWS
+ LL_WARNS() << "Invalid path: \"" << utf16str_to_utf8str(dir_path.wstring()) << "\"" << LL_ENDL;
+#else
LL_WARNS() << "Invalid path: \"" << dir_path.string() << "\"" << LL_ENDL;
+#endif
return;
}
@@ -130,7 +134,11 @@ bool LLDirIterator::Impl::next(std::string &fname)
while (mIter != end_itr && !found)
{
boost::smatch match;
+#if LL_WINDOWS
+ std::string name = utf16str_to_utf8str(mIter->path().filename().wstring());
+#else
std::string name = mIter->path().filename().string();
+#endif
found = ll_regex_match(name, match, mFilterExp);
if (found)
{
diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index 49904911a9..d9b223fb49 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -114,14 +114,22 @@ void LLDiskCache::purge()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (ec.failed())
{
continue;
}
+#if LL_WINDOWS
+ const std::string file_path = utf16str_to_utf8str((*iter).path().wstring());
+#else
const std::string file_path = (*iter).path().string();
+#endif
const std::time_t file_time = boost::filesystem::last_write_time(*iter, ec);
if (ec.failed())
{
@@ -159,10 +167,16 @@ void LLDiskCache::purge()
}
if (should_remove)
{
+#if LL_WINDOWS
+ boost::filesystem::remove(utf8str_to_utf16str(entry.second.second), ec);
+#else
boost::filesystem::remove(entry.second.second, ec);
+#endif
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -237,12 +251,18 @@ void LLDiskCache::clearCache()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -270,13 +290,20 @@ void LLDiskCache::removeOldVFSFiles()
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if ((utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FORMAT) != std::string::npos) ||
+ (utf16str_to_utf8str((*iter).path().wstring()).find(DB_FORMAT) != std::string::npos))
+#else
if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) ||
((*iter).path().string().find(DB_FORMAT) != std::string::npos))
+#endif
{
boost::filesystem::remove(*iter, ec);
if (ec.failed())
{
+#if !LL_WINDOWS
LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL;
+#endif
}
}
}
@@ -311,7 +338,11 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir)
{
if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed())
{
+#if LL_WINDOWS
+ if (utf16str_to_utf8str((*iter).path().wstring()).find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#else
if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos)
+#endif
{
uintmax_t file_size = boost::filesystem::file_size(*iter, ec);
if (!ec.failed())