other-licenses/7zstub/src/7zip/UI/Common/DefaultName.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/7zstub/src/7zip/UI/Common/DefaultName.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +// DefaultName.cpp
     1.5 +
     1.6 +#include "StdAfx.h"
     1.7 +
     1.8 +#include "DefaultName.h"
     1.9 +
    1.10 +static const wchar_t *kEmptyFileAlias = L"[Content]";
    1.11 +
    1.12 +UString GetDefaultName2(const UString &fileName, 
    1.13 +    const UString &extension, const UString &addSubExtension)
    1.14 +{
    1.15 +  int extLength = extension.Length();
    1.16 +  int fileNameLength = fileName.Length();
    1.17 +  if (fileNameLength > extLength + 1)
    1.18 +  {
    1.19 +    int dotPos = fileNameLength - (extLength + 1);
    1.20 +    if (fileName[dotPos] == '.')
    1.21 +      if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0)
    1.22 +        return fileName.Left(dotPos) + addSubExtension;
    1.23 +  }
    1.24 +  return kEmptyFileAlias;
    1.25 +}
    1.26 +

mercurial