equal
deleted
inserted
replaced
1 // DefaultName.cpp |
|
2 |
|
3 #include "StdAfx.h" |
|
4 |
|
5 #include "DefaultName.h" |
|
6 |
|
7 static const wchar_t *kEmptyFileAlias = L"[Content]"; |
|
8 |
|
9 UString GetDefaultName2(const UString &fileName, |
|
10 const UString &extension, const UString &addSubExtension) |
|
11 { |
|
12 int extLength = extension.Length(); |
|
13 int fileNameLength = fileName.Length(); |
|
14 if (fileNameLength > extLength + 1) |
|
15 { |
|
16 int dotPos = fileNameLength - (extLength + 1); |
|
17 if (fileName[dotPos] == '.') |
|
18 if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0) |
|
19 return fileName.Left(dotPos) + addSubExtension; |
|
20 } |
|
21 int dotPos = fileName.ReverseFind(L'.'); |
|
22 if (dotPos > 0) |
|
23 return fileName.Left(dotPos) + addSubExtension; |
|
24 return kEmptyFileAlias; |
|
25 } |
|
26 |
|