diff options
author | Jacek Antonelli | 2008-12-01 17:39:58 -0600 |
---|---|---|
committer | Jacek Antonelli | 2008-12-01 17:40:06 -0600 |
commit | 7abecb48babe6a6f09bf6692ba55076546cfced9 (patch) | |
tree | 8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/llvfs | |
parent | Second Life viewer sources 1.21.6 (diff) | |
download | meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2 meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz |
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/llvfs')
-rw-r--r-- | linden/indra/llvfs/CMakeLists.txt | 6 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir.cpp | 23 | ||||
-rw-r--r-- | linden/indra/llvfs/lldir.h | 14 | ||||
-rw-r--r-- | linden/indra/llvfs/llvfile.cpp | 1 | ||||
-rw-r--r-- | linden/indra/llvfs/llvfs.cpp | 2 |
5 files changed, 40 insertions, 6 deletions
diff --git a/linden/indra/llvfs/CMakeLists.txt b/linden/indra/llvfs/CMakeLists.txt index 9f136f7..c3c12ef 100644 --- a/linden/indra/llvfs/CMakeLists.txt +++ b/linden/indra/llvfs/CMakeLists.txt | |||
@@ -56,3 +56,9 @@ set_source_files_properties(${llvfs_HEADER_FILES} | |||
56 | list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES}) | 56 | list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES}) |
57 | 57 | ||
58 | add_library (llvfs ${llvfs_SOURCE_FILES}) | 58 | add_library (llvfs ${llvfs_SOURCE_FILES}) |
59 | |||
60 | if (DARWIN) | ||
61 | include(CMakeFindFrameworks) | ||
62 | find_library(CARBON_LIBRARY Carbon) | ||
63 | target_link_libraries(llvfs ${CARBON_LIBRARY}) | ||
64 | endif (DARWIN) | ||
diff --git a/linden/indra/llvfs/lldir.cpp b/linden/indra/llvfs/lldir.cpp index 0e014d9..5bfe11f 100644 --- a/linden/indra/llvfs/lldir.cpp +++ b/linden/indra/llvfs/lldir.cpp | |||
@@ -497,6 +497,29 @@ std::string LLDir::getTempFilename() const | |||
497 | return temp_filename; | 497 | return temp_filename; |
498 | } | 498 | } |
499 | 499 | ||
500 | // static | ||
501 | std::string LLDir::getScrubbedFileName(const std::string uncleanFileName) | ||
502 | { | ||
503 | std::string name(uncleanFileName); | ||
504 | const std::string illegalChars(getForbiddenFileChars()); | ||
505 | // replace any illegal file chars with and underscore '_' | ||
506 | for( unsigned int i = 0; i < illegalChars.length(); i++ ) | ||
507 | { | ||
508 | int j = -1; | ||
509 | while((j = name.find(illegalChars[i])) > -1) | ||
510 | { | ||
511 | name[j] = '_'; | ||
512 | } | ||
513 | } | ||
514 | return name; | ||
515 | } | ||
516 | |||
517 | // static | ||
518 | std::string LLDir::getForbiddenFileChars() | ||
519 | { | ||
520 | return "\\/:*?\"<>|"; | ||
521 | } | ||
522 | |||
500 | void LLDir::setLindenUserDir(const std::string &first, const std::string &last) | 523 | void LLDir::setLindenUserDir(const std::string &first, const std::string &last) |
501 | { | 524 | { |
502 | // if both first and last aren't set, assume we're grabbing the cached dir | 525 | // if both first and last aren't set, assume we're grabbing the cached dir |
diff --git a/linden/indra/llvfs/lldir.h b/linden/indra/llvfs/lldir.h index dbddf7d..2626d19 100644 --- a/linden/indra/llvfs/lldir.h +++ b/linden/indra/llvfs/lldir.h | |||
@@ -64,12 +64,12 @@ class LLDir | |||
64 | 64 | ||
65 | virtual void initAppDirs(const std::string &app_name) = 0; | 65 | virtual void initAppDirs(const std::string &app_name) = 0; |
66 | public: | 66 | public: |
67 | virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); | 67 | virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); |
68 | 68 | ||
69 | // pure virtual functions | 69 | // pure virtual functions |
70 | virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; | 70 | virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask) = 0; |
71 | virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) = 0; | 71 | virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) = 0; |
72 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0; | 72 | virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) = 0; |
73 | virtual std::string getCurPath() = 0; | 73 | virtual std::string getCurPath() = 0; |
74 | virtual BOOL fileExists(const std::string &filename) const = 0; | 74 | virtual BOOL fileExists(const std::string &filename) const = 0; |
75 | 75 | ||
@@ -104,7 +104,7 @@ class LLDir | |||
104 | std::string getBaseFileName(const std::string& filepath, bool strip_exten = false) const; | 104 | std::string getBaseFileName(const std::string& filepath, bool strip_exten = false) const; |
105 | std::string getDirName(const std::string& filepath) const; | 105 | std::string getDirName(const std::string& filepath) const; |
106 | std::string getExtension(const std::string& filepath) const; // Excludes '.', e.g getExtension("foo.wav") == "wav" | 106 | std::string getExtension(const std::string& filepath) const; // Excludes '.', e.g getExtension("foo.wav") == "wav" |
107 | 107 | ||
108 | // these methods search the various skin paths for the specified file in the following order: | 108 | // these methods search the various skin paths for the specified file in the following order: |
109 | // getUserSkinDir(), getSkinDir(), getDefaultSkinDir() | 109 | // getUserSkinDir(), getSkinDir(), getDefaultSkinDir() |
110 | std::string findSkinnedFilename(const std::string &filename) const; | 110 | std::string findSkinnedFilename(const std::string &filename) const; |
@@ -114,6 +114,10 @@ class LLDir | |||
114 | // random filename in common temporary directory | 114 | // random filename in common temporary directory |
115 | std::string getTempFilename() const; | 115 | std::string getTempFilename() const; |
116 | 116 | ||
117 | // For producing safe download file names from potentially unsafe ones | ||
118 | static std::string getScrubbedFileName(const std::string uncleanFileName); | ||
119 | static std::string getForbiddenFileChars(); | ||
120 | |||
117 | virtual void setChatLogsDir(const std::string &path); // Set the chat logs dir to this user's dir | 121 | virtual void setChatLogsDir(const std::string &path); // Set the chat logs dir to this user's dir |
118 | virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last); // Set the per user chat log directory. | 122 | virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last); // Set the per user chat log directory. |
119 | virtual void setLindenUserDir(const std::string &first, const std::string &last); // Set the linden user dir to this user's dir | 123 | virtual void setLindenUserDir(const std::string &first, const std::string &last); // Set the linden user dir to this user's dir |
diff --git a/linden/indra/llvfs/llvfile.cpp b/linden/indra/llvfs/llvfile.cpp index 61de885..fbdd738 100644 --- a/linden/indra/llvfs/llvfile.cpp +++ b/linden/indra/llvfs/llvfile.cpp | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include "llerror.h" | 36 | #include "llerror.h" |
37 | #include "llthread.h" | 37 | #include "llthread.h" |
38 | #include "llstat.h" | ||
38 | #include "llvfs.h" | 39 | #include "llvfs.h" |
39 | 40 | ||
40 | const S32 LLVFile::READ = 0x00000001; | 41 | const S32 LLVFile::READ = 0x00000001; |
diff --git a/linden/indra/llvfs/llvfs.cpp b/linden/indra/llvfs/llvfs.cpp index b3d02a5..82d2723 100644 --- a/linden/indra/llvfs/llvfs.cpp +++ b/linden/indra/llvfs/llvfs.cpp | |||
@@ -1266,7 +1266,7 @@ void LLVFS::eraseBlockLength(LLVFSBlock *block) | |||
1266 | } | 1266 | } |
1267 | if(!found_block) | 1267 | if(!found_block) |
1268 | { | 1268 | { |
1269 | llwarns << "eraseBlock could not find block" << llendl; | 1269 | llerrs << "eraseBlock could not find block" << llendl; |
1270 | } | 1270 | } |
1271 | } | 1271 | } |
1272 | 1272 | ||