diff options
author | Kitty Barnett <develop@catznip.com> | 2024-09-30 15:54:20 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2024-09-30 15:54:20 +0200 |
commit | ed2d4f02d93459bf114ebeab8727d507b7bfc0ef (patch) | |
tree | a216907e2c01db7932c83e212319cb7a8c790013 /indra/llfilesystem | |
parent | a8d8314cb9af193ea7ce95456fb308217ba28e3c (diff) | |
parent | a409503653bebacbc498409806f9e1a4b97ed6ac (diff) |
Merge branch 'develop' into rlva/base
Diffstat (limited to 'indra/llfilesystem')
-rw-r--r-- | indra/llfilesystem/lldir.cpp | 5 | ||||
-rw-r--r-- | indra/llfilesystem/lldir.h | 1 | ||||
-rw-r--r-- | indra/llfilesystem/tests/lldir_test.cpp | 31 |
3 files changed, 21 insertions, 16 deletions
diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index 99d4850610..2818aaf86c 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -468,6 +468,7 @@ static std::string ELLPathToString(ELLPath location) ENT(LL_PATH_DEFAULT_SKIN) ENT(LL_PATH_FONTS) ENT(LL_PATH_LAST) + ENT(LL_PATH_SCRIPTS) ; #undef ENT @@ -588,6 +589,10 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd prefix = add(getAppRODataDir(), "fonts"); break; + case LL_PATH_SCRIPTS: + prefix = add(getAppRODataDir(), "scripts"); + break; + default: llassert(0); } diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index b0d2b6aada..241f151d47 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -49,6 +49,7 @@ typedef enum ELLPath LL_PATH_DEFAULT_SKIN = 17, LL_PATH_FONTS = 18, LL_PATH_DUMP = 19, + LL_PATH_SCRIPTS = 20, LL_PATH_LAST } ELLPath; diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index 6e191ad096..4fa5769f65 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -27,12 +27,14 @@ #include "linden_common.h" +#include <filesystem> #include "llstring.h" #include "tests/StringVec.h" #include "../lldir.h" #include "../lldiriterator.h" #include "../test/lltut.h" +#include "../test/namedtempfile.h" #include "stringize.h" #include <boost/assign/list_of.hpp> @@ -425,23 +427,19 @@ namespace tut return path; } - std::string makeTestDir( const std::string& dirbase ) + std::string makeTestDir( ) { - int counter; - std::string uniqueDir; - bool foundUnused; - std::string delim = gDirUtilp->getDirDelimiter(); + auto p = NamedTempFile::temp_path(); + std::filesystem::create_directories(p.native()); - for (counter=0, foundUnused=false; !foundUnused; counter++ ) - { - char counterStr[3]; - sprintf(counterStr, "%02d", counter); - uniqueDir = dirbase + counterStr; - foundUnused = ! ( LLFile::isdir(uniqueDir) || LLFile::isfile(uniqueDir) ); - } - ensure("test directory '" + uniqueDir + "' creation failed", !LLFile::mkdir(uniqueDir)); + std::string ret = p.string(); - return uniqueDir + delim; // HACK - apparently, the trailing delimiter is needed... + // There's an implicit assumtion all over this code that the returned path ends with "/" (or "\") + + if(ret.size() >= 1 && ret[ ret.size()-1 ] != std::filesystem::path::preferred_separator ) + ret += std::filesystem::path::preferred_separator; + + return ret; } static const char* DirScanFilename[5] = { "file1.abc", "file2.abc", "file1.xyz", "file2.xyz", "file1.mno" }; @@ -497,8 +495,9 @@ namespace tut // Create the same 5 file names of the two directories - std::string dir1 = makeTestDir(dirTemp + "LLDirIterator"); - std::string dir2 = makeTestDir(dirTemp + "LLDirIterator"); + std::string dir1 = makeTestDir(); + std::string dir2 = makeTestDir(); + std::string dir1files[5]; std::string dir2files[5]; for (int i=0; i<5; i++) |