diff options
Diffstat (limited to 'linden/indra/llvfs/lldir.cpp')
-rw-r--r-- | linden/indra/llvfs/lldir.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/linden/indra/llvfs/lldir.cpp b/linden/indra/llvfs/lldir.cpp index 8cd2b5c..1dc00dd 100644 --- a/linden/indra/llvfs/lldir.cpp +++ b/linden/indra/llvfs/lldir.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2002-2008, Linden Research, Inc. | 7 | * Copyright (c) 2002-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -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 |