Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/UI/Common/ArchiveName.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // ArchiveName.cpp
2
3 #include "StdAfx.h"
4
5 #include "Windows/FileFind.h"
6 #include "Windows/FileDir.h"
7
8 using namespace NWindows;
9
10 UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
11 {
12 UString resultName = L"Archive";
13 if (fromPrev)
14 {
15 UString dirPrefix;
16 if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
17 {
18 if (dirPrefix.Length() > 0)
19 if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR)
20 {
21 dirPrefix.Delete(dirPrefix.Length() - 1);
22 NFile::NFind::CFileInfoW fileInfo;
23 if (NFile::NFind::FindFile(dirPrefix, fileInfo))
24 resultName = fileInfo.Name;
25 }
26 }
27 }
28 else
29 {
30 NFile::NFind::CFileInfoW fileInfo;
31 if (!NFile::NFind::FindFile(srcName, fileInfo))
32 return resultName;
33 resultName = fileInfo.Name;
34 if (!fileInfo.IsDir() && !keepName)
35 {
36 int dotPos = resultName.ReverseFind('.');
37 if (dotPos > 0)
38 {
39 UString archiveName2 = resultName.Left(dotPos);
40 if (archiveName2.ReverseFind('.') < 0)
41 resultName = archiveName2;
42 }
43 }
44 }
45 return resultName;
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698