| OLD | NEW |
| (Empty) |
| 1 // DefaultName.cpp | |
| 2 | |
| 3 #include "StdAfx.h" | |
| 4 | |
| 5 #include "DefaultName.h" | |
| 6 | |
| 7 static UString GetDefaultName3(const UString &fileName, | |
| 8 const UString &extension, const UString &addSubExtension) | |
| 9 { | |
| 10 int extLength = extension.Length(); | |
| 11 int fileNameLength = fileName.Length(); | |
| 12 if (fileNameLength > extLength + 1) | |
| 13 { | |
| 14 int dotPos = fileNameLength - (extLength + 1); | |
| 15 if (fileName[dotPos] == '.') | |
| 16 if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0) | |
| 17 return fileName.Left(dotPos) + addSubExtension; | |
| 18 } | |
| 19 int dotPos = fileName.ReverseFind(L'.'); | |
| 20 if (dotPos > 0) | |
| 21 return fileName.Left(dotPos) + addSubExtension; | |
| 22 | |
| 23 if (addSubExtension.IsEmpty()) | |
| 24 return fileName + L"~"; | |
| 25 else | |
| 26 return fileName + addSubExtension; | |
| 27 } | |
| 28 | |
| 29 UString GetDefaultName2(const UString &fileName, | |
| 30 const UString &extension, const UString &addSubExtension) | |
| 31 { | |
| 32 UString name = GetDefaultName3(fileName, extension, addSubExtension); | |
| 33 name.TrimRight(); | |
| 34 return name; | |
| 35 } | |
| OLD | NEW |