mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 04:07:08 -06:00
9.21
This commit is contained in:
committed by
Kornel Lesiński
parent
de4f8c22fe
commit
35596517f2
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "ExtractCallback.h"
|
||||
@@ -18,7 +19,7 @@ static LPCWSTR kCantOpenFile = L"Can not open output file";
|
||||
static LPCWSTR kUnsupportedMethod = L"Unsupported Method";
|
||||
|
||||
void CExtractCallbackImp::Init(IInArchive *archiveHandler,
|
||||
const UString &directoryPath,
|
||||
const FString &directoryPath,
|
||||
const UString &itemDefaultName,
|
||||
const FILETIME &defaultMTime,
|
||||
UInt32 defaultAttributes)
|
||||
@@ -76,12 +77,12 @@ STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *completeValue)
|
||||
|
||||
void CExtractCallbackImp::CreateComplexDirectory(const UStringVector &dirPathParts)
|
||||
{
|
||||
UString fullPath = _directoryPath;
|
||||
for(int i = 0; i < dirPathParts.Size(); i++)
|
||||
FString fullPath = _directoryPath;
|
||||
for (int i = 0; i < dirPathParts.Size(); i++)
|
||||
{
|
||||
fullPath += dirPathParts[i];
|
||||
fullPath += us2fs(dirPathParts[i]);
|
||||
NDirectory::MyCreateDirectory(fullPath);
|
||||
fullPath += NName::kDirDelimiter;
|
||||
fullPath += FCHAR_PATH_SEPARATOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
|
||||
CreateComplexDirectory(pathParts);
|
||||
}
|
||||
|
||||
UString fullProcessedPath = _directoryPath + processedPath;
|
||||
FString fullProcessedPath = _directoryPath + us2fs(processedPath);
|
||||
|
||||
if (_processedFileInfo.IsDir)
|
||||
{
|
||||
@@ -166,7 +167,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
NFind::CFileInfoW fileInfo;
|
||||
NFind::CFileInfo fileInfo;
|
||||
if (fileInfo.Find(fullProcessedPath))
|
||||
{
|
||||
if (!NDirectory::DeleteFileAlways(fullProcessedPath))
|
||||
|
||||
@@ -31,9 +31,9 @@ public:
|
||||
|
||||
private:
|
||||
CMyComPtr<IInArchive> _archiveHandler;
|
||||
UString _directoryPath;
|
||||
FString _directoryPath;
|
||||
UString _filePath;
|
||||
UString _diskFilePath;
|
||||
FString _diskFilePath;
|
||||
|
||||
bool _extractMode;
|
||||
struct CProcessedFileInfo
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
UString _message;
|
||||
|
||||
void Init(IInArchive *archiveHandler,
|
||||
const UString &directoryPath,
|
||||
const FString &directoryPath,
|
||||
const UString &itemDefaultName,
|
||||
const FILETIME &defaultMTime,
|
||||
UInt32 defaultAttributes);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/Thread.h"
|
||||
|
||||
#include "../../UI/Common/OpenArchive.h"
|
||||
@@ -20,8 +21,8 @@ static LPCWSTR kCantOpenArchive = L"Can not open the file as archive";
|
||||
struct CThreadExtracting
|
||||
{
|
||||
CCodecs *Codecs;
|
||||
UString FileName;
|
||||
UString DestFolder;
|
||||
FString FileName;
|
||||
FString DestFolder;
|
||||
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
CMyComPtr<IArchiveExtractCallback> ExtractCallback;
|
||||
@@ -32,7 +33,7 @@ struct CThreadExtracting
|
||||
|
||||
void Process2()
|
||||
{
|
||||
NFile::NFind::CFileInfoW fi;
|
||||
NFile::NFind::CFileInfo fi;
|
||||
if (!fi.Find(FileName))
|
||||
{
|
||||
ErrorMessage = kCantFindArchive;
|
||||
@@ -40,7 +41,7 @@ struct CThreadExtracting
|
||||
return;
|
||||
}
|
||||
|
||||
Result = ArchiveLink.Open2(Codecs, CIntVector(), false, NULL, FileName, ExtractCallbackSpec);
|
||||
Result = ArchiveLink.Open2(Codecs, CIntVector(), false, NULL, fs2us(FileName), ExtractCallbackSpec);
|
||||
if (Result != S_OK)
|
||||
{
|
||||
if (Result != S_OK)
|
||||
@@ -48,7 +49,7 @@ struct CThreadExtracting
|
||||
return;
|
||||
}
|
||||
|
||||
UString dirPath = DestFolder;
|
||||
FString dirPath = DestFolder;
|
||||
NFile::NName::NormalizeDirPathPrefix(dirPath);
|
||||
|
||||
if (!NFile::NDirectory::CreateComplexDirectory(dirPath))
|
||||
@@ -57,7 +58,7 @@ struct CThreadExtracting
|
||||
#ifdef LANG
|
||||
0x02000603,
|
||||
#endif
|
||||
dirPath);
|
||||
fs2us(dirPath));
|
||||
Result = E_FAIL;
|
||||
return;
|
||||
}
|
||||
@@ -86,7 +87,7 @@ struct CThreadExtracting
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &destFolder,
|
||||
HRESULT ExtractArchive(CCodecs *codecs, const FString &fileName, const FString &destFolder,
|
||||
bool showProgress, bool &isCorrupt, UString &errorMessage)
|
||||
{
|
||||
isCorrupt = false;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// ExtractEngine.h
|
||||
|
||||
#ifndef __EXTRACTENGINE_H
|
||||
#define __EXTRACTENGINE_H
|
||||
#ifndef __EXTRACT_ENGINE_H
|
||||
#define __EXTRACT_ENGINE_H
|
||||
|
||||
#include "../../UI/Common/LoadCodecs.h"
|
||||
|
||||
HRESULT ExtractArchive(CCodecs *codecs, const UString &fileName, const UString &destFolder,
|
||||
bool showProgress, bool &isCorrupt, UString &errorMessage);
|
||||
HRESULT ExtractArchive(CCodecs *codecs, const FString &fileName, const FString &destFolder,
|
||||
bool showProgress, bool &isCorrupt, UString &errorMessage);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileIO.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/NtCheck.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
@@ -25,11 +26,11 @@ using namespace NWindows;
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
static LPCTSTR kTempDirPrefix = TEXT("7zS");
|
||||
static CFSTR kTempDirPrefix = FTEXT("7zS");
|
||||
|
||||
#define _SHELL_EXECUTE
|
||||
|
||||
static bool ReadDataString(LPCWSTR fileName, LPCSTR startID,
|
||||
static bool ReadDataString(CFSTR fileName, LPCSTR startID,
|
||||
LPCSTR endID, AString &stringResult)
|
||||
{
|
||||
stringResult.Empty();
|
||||
@@ -107,11 +108,11 @@ public:
|
||||
#ifndef UNDER_CE
|
||||
class CCurrentDirRestorer
|
||||
{
|
||||
CSysString m_CurrentDirectory;
|
||||
FString m_CurrentDirectory;
|
||||
public:
|
||||
CCurrentDirRestorer() { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); }
|
||||
~CCurrentDirRestorer() { RestoreDirectory();}
|
||||
bool RestoreDirectory() { return BOOLToBool(::SetCurrentDirectory(m_CurrentDirectory)); }
|
||||
bool RestoreDirectory() const { return NFile::NDirectory::MySetCurrentDirectory(m_CurrentDirectory); }
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -137,8 +138,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
#endif
|
||||
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
|
||||
|
||||
UString fullPath;
|
||||
NDLL::MyGetModuleFileName(g_hInstance, fullPath);
|
||||
FString fullPath;
|
||||
NDLL::MyGetModuleFileName(fullPath);
|
||||
|
||||
switches.Trim();
|
||||
bool assumeYes = false;
|
||||
@@ -191,7 +192,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
#endif
|
||||
}
|
||||
|
||||
NFile::NDirectory::CTempDirectory tempDir;
|
||||
NFile::NDirectory::CTempDir tempDir;
|
||||
if (!tempDir.Create(kTempDirPrefix))
|
||||
{
|
||||
if (!assumeYes)
|
||||
@@ -208,7 +209,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
return 1;
|
||||
}
|
||||
|
||||
UString tempDirPath = GetUnicodeString(tempDir.GetPath());
|
||||
FString tempDirPath = tempDir.GetPath();
|
||||
{
|
||||
bool isCorrupt = false;
|
||||
UString errorMessage;
|
||||
@@ -233,7 +234,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
|
||||
#ifndef UNDER_CE
|
||||
CCurrentDirRestorer currentDirRestorer;
|
||||
if (!SetCurrentDirectory(tempDir.GetPath()))
|
||||
if (!NFile::NDirectory::MySetCurrentDirectory(tempDir.GetPath()))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
@@ -281,7 +282,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
if (appLaunched.IsEmpty())
|
||||
{
|
||||
appLaunched = L"setup.exe";
|
||||
if (!NFile::NFind::DoesFileExist(GetSystemString(appLaunched)))
|
||||
if (!NFile::NFind::DoesFileExist(us2fs(appLaunched)))
|
||||
{
|
||||
if (!assumeYes)
|
||||
ShowErrorMessage(L"Can not find setup.exe");
|
||||
@@ -290,12 +291,12 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
}
|
||||
|
||||
{
|
||||
UString s2 = tempDirPath;
|
||||
FString s2 = tempDirPath;
|
||||
NFile::NName::NormalizeDirPathPrefix(s2);
|
||||
appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, s2);
|
||||
appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, fs2us(s2));
|
||||
}
|
||||
|
||||
appLaunched.Replace(L"%%T", tempDirPath);
|
||||
appLaunched.Replace(L"%%T", fs2us(tempDirPath));
|
||||
|
||||
if (!switches.IsEmpty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user