mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 16:07:04 -06:00
23.01
This commit is contained in:
@@ -2,11 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#include "../../../Common/Wildcard.h"
|
||||
|
||||
#include "../../../Windows/FileFind.h"
|
||||
#include "../../../Windows/FileName.h"
|
||||
#include "../../../Windows/FileSystem.h"
|
||||
|
||||
#include "WorkDir.h"
|
||||
|
||||
@@ -22,10 +19,10 @@ FString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const FString &path, FStr
|
||||
if (workDirInfo.ForRemovableOnly)
|
||||
{
|
||||
mode = NWorkDir::NMode::kCurrent;
|
||||
FString prefix = path.Left(3);
|
||||
if (prefix[1] == FTEXT(':') && prefix[2] == FTEXT('\\'))
|
||||
const FString prefix = path.Left(3);
|
||||
if (NName::IsDrivePath(prefix))
|
||||
{
|
||||
UINT driveType = GetDriveType(GetSystemString(prefix, ::AreFileApisANSI() ? CP_ACP : CP_OEMCP));
|
||||
const UINT driveType = NSystem::MyGetDriveType(prefix);
|
||||
if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE)
|
||||
mode = workDirInfo.Mode;
|
||||
}
|
||||
@@ -39,29 +36,26 @@ FString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const FString &path, FStr
|
||||
}
|
||||
#endif
|
||||
|
||||
int pos = path.ReverseFind_PathSepar() + 1;
|
||||
const int pos = path.ReverseFind_PathSepar() + 1;
|
||||
fileName = path.Ptr((unsigned)pos);
|
||||
|
||||
switch (mode)
|
||||
FString tempDir;
|
||||
switch ((int)mode)
|
||||
{
|
||||
case NWorkDir::NMode::kCurrent:
|
||||
{
|
||||
return path.Left((unsigned)pos);
|
||||
}
|
||||
tempDir = path.Left((unsigned)pos);
|
||||
break;
|
||||
case NWorkDir::NMode::kSpecified:
|
||||
{
|
||||
FString tempDir = workDirInfo.Path;
|
||||
NName::NormalizeDirPathPrefix(tempDir);
|
||||
return tempDir;
|
||||
}
|
||||
tempDir = workDirInfo.Path;
|
||||
break;
|
||||
// case NWorkDir::NMode::kSystem:
|
||||
default:
|
||||
{
|
||||
FString tempDir;
|
||||
if (!MyGetTempPath(tempDir))
|
||||
throw 141717;
|
||||
return tempDir;
|
||||
}
|
||||
break;
|
||||
}
|
||||
NName::NormalizeDirPathPrefix(tempDir);
|
||||
return tempDir;
|
||||
}
|
||||
|
||||
HRESULT CWorkDirTempFile::CreateTempFile(const FString &originalPath)
|
||||
@@ -69,9 +63,8 @@ HRESULT CWorkDirTempFile::CreateTempFile(const FString &originalPath)
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
workDirInfo.Load();
|
||||
FString namePart;
|
||||
FString workDir = GetWorkDir(workDirInfo, originalPath, namePart);
|
||||
const FString workDir = GetWorkDir(workDirInfo, originalPath, namePart);
|
||||
CreateComplexDir(workDir);
|
||||
CTempFile tempFile;
|
||||
_outStreamSpec = new COutFileStream;
|
||||
OutStream = _outStreamSpec;
|
||||
if (!_tempFile.Create(workDir + namePart, &_outStreamSpec->File))
|
||||
|
||||
Reference in New Issue
Block a user