This commit is contained in:
Igor Pavlov
2005-06-28 00:00:00 +00:00
committed by Kornel Lesiński
parent 3c510ba80b
commit ac2b563958
83 changed files with 3668 additions and 1316 deletions

View File

@@ -161,7 +161,8 @@ STDMETHODIMP CAgent::DoOperation(
UString folderPrefix = _folderPrefix;
NFile::NName::NormalizeDirPathPrefix(folderPrefix);
RINOK(::EnumerateDirItems(folderPrefix, _names, _archiveNamePrefix, dirItems));
UString errorPath;
RINOK(::EnumerateDirItems(folderPrefix, _names, _archiveNamePrefix, dirItems, errorPath));
NWindows::NDLL::CLibrary library;

View File

@@ -719,7 +719,9 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
AddCommandLineWildCardToCensr(archiveWildcardCensor, options.ArchiveName, true, NRecursedType::kNonRecursed);
CObjectVector<CDirItem> dirItems;
EnumerateItems(archiveWildcardCensor, dirItems, NULL);
UString errorPath;
if (EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPath) != S_OK)
throw "cannot find archive";
UStringVector archivePaths;
int i;
for (i = 0; i < dirItems.Size(); i++)

View File

@@ -35,7 +35,7 @@ static bool IsItWindowsNT()
}
HRESULT MyCreateProcess(const UString &params,
LPCTSTR curDir,
LPCTSTR curDir, bool waitFinish,
NWindows::NSynchronization::CEvent *event)
{
STARTUPINFO startupInfo;
@@ -57,13 +57,15 @@ HRESULT MyCreateProcess(const UString &params,
return ::GetLastError();
else
{
if (event != NULL)
::CloseHandle(processInformation.hThread);
if (waitFinish)
WaitForSingleObject(processInformation.hProcess, INFINITE);
else if (event != NULL)
{
HANDLE handles[] = {processInformation.hProcess, *event };
::WaitForMultipleObjects(sizeof(handles) / sizeof(handles[0]),
handles, FALSE, INFINITE);
handles, FALSE, INFINITE);
}
::CloseHandle(processInformation.hThread);
::CloseHandle(processInformation.hProcess);
}
return S_OK;
@@ -175,7 +177,8 @@ HRESULT CompressFiles(
const UStringVector &names,
// const UString &outFolder,
bool email,
bool showDialog)
bool showDialog,
bool waitFinish)
{
/*
UString curDir;
@@ -281,7 +284,7 @@ HRESULT CompressFiles(
CSysString sysCurDir = GetSystemString(curDir);
RINOK(MyCreateProcess(params,
(sysCurDir.IsEmpty()? 0: (LPCTSTR)sysCurDir),
&event));
waitFinish, &event));
}
catch(...)
{
@@ -310,7 +313,7 @@ static HRESULT ExtractGroupCommand(const UStringVector &archivePaths,
CFileMapping fileMapping;
NSynchronization::CEvent event;
RINOK(CreateMap(archivePaths, L"7zExtract", fileMapping, event, params2));
return MyCreateProcess(params2, 0, &event);
return MyCreateProcess(params2, 0, false, &event);
}
HRESULT ExtractArchives(const UStringVector &archivePaths,

View File

@@ -7,14 +7,14 @@
#include "Windows/Synchronization.h"
HRESULT MyCreateProcess(const UString &params,
LPCTSTR lpCurrentDirectory,
NWindows::NSynchronization::CEvent *event = NULL);
LPCTSTR lpCurrentDirectory, bool waitFinish,
NWindows::NSynchronization::CEvent *event);
HRESULT CompressFiles(
const UString &curDir,
const UString &archiveName,
const UStringVector &names,
// const UString &outFolder,
bool email, bool showDialog);
bool email, bool showDialog, bool waitFinish);
HRESULT ExtractArchives(
const UStringVector &archivePaths,

View File

@@ -35,7 +35,8 @@ static HRESULT EnumerateDirectory(
const UString &baseFolderPrefix,
const UString &directory,
const UString &prefix,
CObjectVector<CDirItem> &dirItems)
CObjectVector<CDirItem> &dirItems,
UString &errorPath)
{
NFind::CEnumeratorW enumerator(baseFolderPrefix + directory + wchar_t(kAnyStringWildcard));
while (true)
@@ -43,7 +44,11 @@ static HRESULT EnumerateDirectory(
NFind::CFileInfoW fileInfo;
bool found;
if (!enumerator.Next(fileInfo, found))
return ::GetLastError();
{
HRESULT error = ::GetLastError();
errorPath = baseFolderPrefix + directory;
return error;
}
if (!found)
break;
AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo,
@@ -51,7 +56,7 @@ static HRESULT EnumerateDirectory(
if (fileInfo.IsDirectory())
{
RINOK(EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter),
prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems));
prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems, errorPath));
}
}
return S_OK;
@@ -61,7 +66,8 @@ HRESULT EnumerateDirItems(
const UString &baseFolderPrefix,
const UStringVector &fileNames,
const UString &archiveNamePrefix,
CObjectVector<CDirItem> &dirItems)
CObjectVector<CDirItem> &dirItems,
UString &errorPath)
{
for(int i = 0; i < fileNames.Size(); i++)
{
@@ -74,7 +80,7 @@ HRESULT EnumerateDirItems(
{
RINOK(EnumerateDirectory(baseFolderPrefix, fileName + wchar_t(kDirDelimiter),
archiveNamePrefix + fileInfo.Name + wchar_t(kDirDelimiter),
dirItems));
dirItems, errorPath));
}
}
return S_OK;
@@ -87,7 +93,8 @@ static HRESULT EnumerateDirItems(
const UString &addArchivePrefix,
CObjectVector<CDirItem> &dirItems,
bool enterToSubFolders,
IEnumDirItemCallback *callback)
IEnumDirItemCallback *callback,
UString &errorPath)
{
if (!enterToSubFolders)
if (curNode.NeedCheckSubDirs())
@@ -100,7 +107,11 @@ static HRESULT EnumerateDirItems(
NFind::CFileInfoW fileInfo;
bool found;
if (!enumerator.Next(fileInfo, found))
return ::GetLastError();
{
HRESULT error = ::GetLastError();
errorPath = diskPrefix;
return error;
}
if (!found)
break;
@@ -140,20 +151,23 @@ static HRESULT EnumerateDirItems(
RINOK(EnumerateDirItems(*nextNode,
diskPrefix + fileInfo.Name + wchar_t(kDirDelimiter),
archivePrefixNew, addArchivePrefixNew,
dirItems, enterToSubFolders2, callback));
dirItems, enterToSubFolders2, callback, errorPath));
}
return S_OK;
}
HRESULT EnumerateItems(const NWildcard::CCensor &censor,
CObjectVector<CDirItem> &dirItems, IEnumDirItemCallback *callback)
HRESULT EnumerateItems(
const NWildcard::CCensor &censor,
CObjectVector<CDirItem> &dirItems,
IEnumDirItemCallback *callback,
UString &errorPath)
{
for (int i = 0; i < censor.Pairs.Size(); i++)
{
if (callback)
RINOK(callback->CheckBreak());
const NWildcard::CPair &pair = censor.Pairs[i];
RINOK(EnumerateDirItems(pair.Head, pair.Prefix, L"", L"", dirItems, false, callback));
RINOK(EnumerateDirItems(pair.Head, pair.Prefix, L"", L"", dirItems, false, callback, errorPath));
}
return S_OK;
}

View File

@@ -19,7 +19,8 @@ HRESULT EnumerateDirItems(
const UString &baseFolderPrefix,
const UStringVector &fileNames,
const UString &archiveNamePrefix,
CObjectVector<CDirItem> &dirItems);
CObjectVector<CDirItem> &dirItems,
UString &errorPath);
struct IEnumDirItemCallback
{
@@ -27,7 +28,10 @@ struct IEnumDirItemCallback
};
HRESULT EnumerateItems(const NWildcard::CCensor &censor,
CObjectVector<CDirItem> &dirItems, IEnumDirItemCallback *callback);
HRESULT EnumerateItems(
const NWildcard::CCensor &censor,
CObjectVector<CDirItem> &dirItems,
IEnumDirItemCallback *callback,
UString &errorPath);
#endif

View File

@@ -694,7 +694,14 @@ HRESULT UpdateArchive(const NWildcard::CCensor &censor,
CEnumDirItemUpdateCallback enumCallback;
enumCallback.Callback = callback;
RINOK(callback->StartScanning());
RINOK(EnumerateItems(censor, dirItems, &enumCallback));
UString errorPath;
HRESULT res = EnumerateItems(censor, dirItems, &enumCallback, errorPath);
if(res != S_OK)
{
errorInfo.Message = L"Scanning error";
errorInfo.FileName = errorPath;
return res;
}
RINOK(callback->FinishScanning());
}
}

View File

@@ -54,7 +54,7 @@ static const char *kCopyrightString = "\n7-Zip"
" [NT]"
#endif
" 4.20 Copyright (c) 1999-2005 Igor Pavlov 2005-05-30\n";
" 4.23 Copyright (c) 1999-2005 Igor Pavlov 2005-06-29\n";
static const char *kHelpString =
"\nUsage: 7z"

View File

@@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,20,0,0
PRODUCTVERSION 4,20,0,0
FILEVERSION 4,23,0,0
PRODUCTVERSION 4,23,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -85,14 +85,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Igor Pavlov\0"
VALUE "FileDescription", "7-Zip Console version\0"
VALUE "FileVersion", "4, 20, 0, 0\0"
VALUE "FileVersion", "4, 23, 0, 0\0"
VALUE "InternalName", "7z\0"
VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "7z.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "7-Zip\0"
VALUE "ProductVersion", "4, 20, 0, 0\0"
VALUE "ProductVersion", "4, 23, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END

View File

@@ -267,6 +267,15 @@ static UString GetSubFolderNameForExtract(const UString &archiveName)
return archiveName + UString(L"~");
}
static UString GetReducedString(const UString &s)
{
const int kMaxSize = 64;
if (s.Length() < kMaxSize)
return s;
const int kFirstPartSize = kMaxSize / 2;
return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize);
}
STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
UINT commandIDFirst, UINT commandIDLast, UINT flags)
{
@@ -388,7 +397,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
folder = L'*';
folder += L'\\';
commandMapItem.Folder = folderPrefix + folder;
s = MyFormatNew(s, folder);
s = MyFormatNew(s, GetReducedString(folder));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s));
_commandMap.push_back(commandMapItem);
}
@@ -426,7 +435,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
FillCommand2(kCompressTo, s, commandMapItem);
commandMapItem.Folder = archivePathPrefix;
commandMapItem.Archive = archiveName7z;
UString t = UString(L"\"") + archiveName7z + UString(L"\"");
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s));
_commandMap.push_back(commandMapItem);
@@ -449,7 +458,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
UString s;
FillCommand2(kCompressToEmail, s, commandMapItem);
commandMapItem.Archive = archiveName7z;
UString t = UString(L"\"") + archiveName7z + UString(L"\"");
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
s = MyFormatNew(s, t);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s));
_commandMap.push_back(commandMapItem);
@@ -633,7 +642,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
params += L" \"";
params += _fileNames[0];
params += L"\"";
MyCreateProcess(params, 0);
MyCreateProcess(params, 0, false, 0);
break;
}
case kExtract:
@@ -659,7 +668,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
bool showDialog = (commandInternalID == kCompress) ||
(commandInternalID == kCompressEmail);
CompressFiles(commandMapItem.Folder, commandMapItem.Archive,
_fileNames, email, showDialog);
_fileNames, email, showDialog, false);
break;
}
}

View File

@@ -68,8 +68,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,20,0,0
PRODUCTVERSION 4,20,0,0
FILEVERSION 4,23,0,0
PRODUCTVERSION 4,23,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -87,14 +87,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Igor Pavlov\0"
VALUE "FileDescription", "7-Zip Shell Extension\0"
VALUE "FileVersion", "4, 20, 0, 0\0"
VALUE "FileVersion", "4, 23, 0, 0\0"
VALUE "InternalName", "7-zip\0"
VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "7-zip.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "7-Zip\0"
VALUE "ProductVersion", "4, 20, 0, 0\0"
VALUE "ProductVersion", "4, 23, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END

View File

@@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,20,0,0
PRODUCTVERSION 4,20,0,0
FILEVERSION 4,23,0,0
PRODUCTVERSION 4,23,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -85,14 +85,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Igor Pavlov\0"
VALUE "FileDescription", "7-Zip FAR Plugin\0"
VALUE "FileVersion", "4, 20, 0, 0\0"
VALUE "FileVersion", "4, 23, 0, 0\0"
VALUE "InternalName", "7-ZipFar\0"
VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "7-ZipFar.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "7-Zip\0"
VALUE "ProductVersion", "4, 20, 0, 0\0"
VALUE "ProductVersion", "4, 23, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END

View File

@@ -1,4 +1,4 @@
// UpdateCallbackConsole.cpp
// UpdateCallbackGUI.cpp
#include "StdAfx.h"
@@ -34,7 +34,7 @@ void CUpdateCallbackGUI::Init()
void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
{
Messages.Add(GetSystemString(message));
Messages.Add(message);
}
HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result)

View File

@@ -53,7 +53,7 @@ public:
ProgressDialog.Create(title, ParentWindow);
}
CSysStringVector Messages;
UStringVector Messages;
int NumArchiveErrors;
void AddErrorMessage(LPCWSTR message);
};

View File

@@ -184,13 +184,17 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
CArchiverInfo archiverInfo;
ReadArchiverInfoList(archivers);
UString currentDirPrefix;
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
return E_FAIL;
NName::NormalizeDirPathPrefix(currentDirPrefix);
}
bool oneFile = false;
NFind::CFileInfoW fileInfo;
if (censor.Pairs.Size() > 0)
{
const NWildcard::CPair &pair = censor.Pairs[0];
currentDirPrefix = pair.Prefix;
if (pair.Head.Items.Size() > 0)
{
const NWildcard::CItem &item = pair.Head.Items[0];

View File

@@ -74,8 +74,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,20,0,0
PRODUCTVERSION 4,20,0,0
FILEVERSION 4,23,0,0
PRODUCTVERSION 4,23,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -93,14 +93,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Igor Pavlov\0"
VALUE "FileDescription", "7-Zip GUI Module\0"
VALUE "FileVersion", "4, 20, 0, 0\0"
VALUE "FileVersion", "4, 23, 0, 0\0"
VALUE "InternalName", "7zg\0"
VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "7zg.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "7-Zip\0"
VALUE "ProductVersion", "4, 20, 0, 0\0"
VALUE "ProductVersion", "4, 23, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END