Skip to content

Commit 7379967

Browse files
committed
Use a predictable path for update files
1 parent e9ee4d8 commit 7379967

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Client/loader/Install.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ struct DirectoryDeleteScope
8888
*/
8989
static bool ExtractSingleArchiveFile(const std::string& archivePath, const SString& targetRoot, const SString& fileName, char* password)
9090
{
91+
if (archivePath.empty())
92+
return false;
93+
9194
RAROpenArchiveDataEx archiveData{};
9295
archiveData.ArcName = const_cast<char*>(archivePath.data());
9396
archiveData.OpenMode = RAR_OM_EXTRACT;
@@ -569,6 +572,7 @@ static int RunInstall()
569572
if (!FileExists(archivePath))
570573
{
571574
AddReportLog(5055, SString("RunInstall: Source archive does not exist: '%s' (source: '%s')", archivePath.c_str(), sourceRoot.c_str()));
575+
archivePath = "";
572576
}
573577

574578
const SString targetRoot = PathConform(GetMTASAPath());
@@ -905,9 +909,9 @@ SString CheckOnRestartCommand()
905909
SString strArchivePath, strArchiveName;
906910
strFile.Split("\\", &strArchivePath, &strArchiveName, -1);
907911

908-
const SString sourceRoot = CreateWritableDirectory(strArchivePath + "\\_" + strArchiveName + "_tmp_");
912+
const SString sourceRoot = MakeUniquePath(strArchivePath + "\\_" + strArchiveName + "_tmp_");
909913

910-
if (sourceRoot.empty())
914+
if (!MkDir(sourceRoot))
911915
return "FileError1";
912916

913917
DirectoryDeleteScope deleteSourceRoot(sourceRoot);

0 commit comments

Comments
 (0)