mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 18:07:08 -06:00
4.20
This commit is contained in:
committed by
Kornel Lesiński
parent
8c1b5c7b7e
commit
3c510ba80b
@@ -2,32 +2,22 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "DefaultName.h"
|
||||
|
||||
const wchar_t *kEmptyFileAlias = L"[Content]";
|
||||
static const wchar_t *kEmptyFileAlias = L"[Content]";
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDirectory;
|
||||
|
||||
UString GetDefaultName(const UString &fullFileName,
|
||||
UString GetDefaultName2(const UString &fileName,
|
||||
const UString &extension, const UString &addSubExtension)
|
||||
{
|
||||
UString fileName;
|
||||
if (!GetOnlyName(fullFileName, fileName))
|
||||
throw 5011749;
|
||||
int extLength = extension.Length();
|
||||
int fileNameLength = fileName.Length();
|
||||
if (fileNameLength <= extLength + 1)
|
||||
return kEmptyFileAlias;
|
||||
int dotPos = fileNameLength - (extLength + 1);
|
||||
if (fileName[dotPos] != '.')
|
||||
return kEmptyFileAlias;
|
||||
if (extension.CollateNoCase(fileName.Mid(dotPos + 1)) == 0)
|
||||
return fileName.Left(dotPos) + addSubExtension;
|
||||
if (fileNameLength > extLength + 1)
|
||||
{
|
||||
int dotPos = fileNameLength - (extLength + 1);
|
||||
if (fileName[dotPos] == '.')
|
||||
if (extension.CollateNoCase(fileName.Mid(dotPos + 1)) == 0)
|
||||
return fileName.Left(dotPos) + addSubExtension;
|
||||
}
|
||||
return kEmptyFileAlias;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user