Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/Common/ArchiveName.cpp')
-rw-r--r--[-rwxr-xr-x]CPP/7zip/UI/Common/ArchiveName.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/CPP/7zip/UI/Common/ArchiveName.cpp b/CPP/7zip/UI/Common/ArchiveName.cpp
index 17947dce..dcf6590e 100755..100644
--- a/CPP/7zip/UI/Common/ArchiveName.cpp
+++ b/CPP/7zip/UI/Common/ArchiveName.cpp
@@ -2,22 +2,38 @@
#include "StdAfx.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
+#include "../../../Windows/FileDir.h"
#include "ExtractingFilePath.h"
+#include "ArchiveName.h"
using namespace NWindows;
+UString CreateArchiveName(const NFile::NFind::CFileInfo fileInfo, bool keepName)
+{
+ FString resultName = fileInfo.Name;
+ if (!fileInfo.IsDir() && !keepName)
+ {
+ int dotPos = resultName.ReverseFind(FTEXT('.'));
+ if (dotPos > 0)
+ {
+ FString archiveName2 = resultName.Left(dotPos);
+ if (archiveName2.ReverseFind(FTEXT('.')) < 0)
+ resultName = archiveName2;
+ }
+ }
+ return GetCorrectFsPath(fs2us(resultName));
+}
+
static FString CreateArchiveName2(const FString &srcName, bool fromPrev, bool keepName)
{
FString resultName = FTEXT("Archive");
if (fromPrev)
{
FString dirPrefix;
- if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
+ if (NFile::NDir::GetOnlyDirPrefix(srcName, dirPrefix))
{
- if (dirPrefix.Length() > 0)
+ if (dirPrefix.Len() > 0)
if (dirPrefix.Back() == FCHAR_PATH_SEPARATOR)
{
dirPrefix.DeleteBack();