Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/Common/ExtractingFilePath.cpp')
-rwxr-xr-xCPP/7zip/UI/Common/ExtractingFilePath.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/CPP/7zip/UI/Common/ExtractingFilePath.cpp b/CPP/7zip/UI/Common/ExtractingFilePath.cpp
index a0b17282..cfd4ae79 100755
--- a/CPP/7zip/UI/Common/ExtractingFilePath.cpp
+++ b/CPP/7zip/UI/Common/ExtractingFilePath.cpp
@@ -3,6 +3,21 @@
#include "StdAfx.h"
#include "ExtractingFilePath.h"
+static UString ReplaceIncorrectChars(const UString &s)
+{
+ UString res;
+ for (int i = 0; i < s.Length(); i++)
+ {
+ wchar_t c = s[i];
+ #ifdef _WIN32
+ if (c < 0x20 || c == '*' || c == '?' || c == '<' || c == '>' || c == '|' || c == ':' || c == '"')
+ c = '_';
+ #endif
+ res += c;
+ }
+ return res;
+}
+
static void ReplaceDisk(UString &s)
{
int i;
@@ -58,7 +73,7 @@ UString GetCorrectPath(const UString &path)
result.Replace(L"../", L"");
ReplaceDisk(result);
- return result;
+ return ReplaceIncorrectChars(result);
}
void MakeCorrectPath(UStringVector &pathParts)