diff options
author | v0lt <v0lt@rambler.ru> | 2013-03-22 20:57:26 +0400 |
---|---|---|
committer | v0lt <v0lt@rambler.ru> | 2013-03-22 20:57:26 +0400 |
commit | 0e2e3b94584d32dd76a654869cd849757f305cc8 (patch) | |
tree | 655316ca3c3039841f6e3d3ae1cdbf310a27d143 /src/DSUtil/text.cpp | |
parent | 5d3529655d6a920d84ecd5db2c77cba18126029b (diff) |
Shaders: shaders moved from ini and registry to separate folder.
(MPC-BE 2296, 2297, 2309, 2342)
Diffstat (limited to 'src/DSUtil/text.cpp')
-rw-r--r-- | src/DSUtil/text.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/DSUtil/text.cpp b/src/DSUtil/text.cpp index d91774d4d..81a9e5af1 100644 --- a/src/DSUtil/text.cpp +++ b/src/DSUtil/text.cpp @@ -219,3 +219,38 @@ CString FormatNumber(CString szNumber, bool bNoFractionalDigits /*= true*/) return ret;
}
+
+void FixFilename(CString& str)
+{
+ str.Trim();
+
+ for (int i = 0, l = str.GetLength(); i < l; i++) {
+ switch (str[i]) {
+ case '?':
+ case '"':
+ case '/':
+ case '\\':
+ case '<':
+ case '>':
+ case '*':
+ case '|':
+ case ':':
+ str.SetAt(i, '_');
+ }
+ }
+
+ CString tmp;
+ if (str.GetLength() == 3 || str.Find('.') == 3) {
+ tmp = str.Left(3).MakeUpper();
+ if (tmp == _T("CON") || tmp == _T("AUX") || tmp == _T("PRN") || tmp == _T("NUL")) {
+ str = _T("___") + str.Mid(3);
+ }
+ }
+ if (str.GetLength() == 4 || str.Find('.') == 4) {
+ tmp = str.Left(4).MakeUpper();
+ if (tmp == _T("COM1") || tmp == _T("COM2") || tmp == _T("COM3") || tmp == _T("COM4") ||
+ tmp == _T("LPT1") || tmp == _T("LPT2") || tmp == _T("LPT3")) {
+ str = _T("____") + str.Mid(4);
+ }
+ }
+}
|