update: Log an error message when extracting the update program fails

stable-5.3
Günther Brammer 2012-11-19 22:45:19 +01:00 committed by Armin Burgmeier
parent 8602298f0d
commit ce49a25d20
2 changed files with 9 additions and 2 deletions

View File

@ -1589,7 +1589,7 @@ bool C4Group::ExtractEntry(const char *szFilename, const char *szExtractTo)
case GRPF_File: // Copy entry to target
// Get entry
C4GroupEntry *pEntry;
if (!(pEntry=GetEntry(szFilename))) return false;
if (!(pEntry=GetEntry(szFilename))) return Error("Extract: Entry not found");
// Create dummy file to reserve target file name
hDummy.Create(szTargetFName,false);
hDummy.Write("Dummy",5);

View File

@ -209,10 +209,17 @@ bool C4UpdateDlg::ApplyUpdate(const char *strUpdateFile, bool fDeleteUpdate, C4G
if (IsWindowsWithUAC()) strUpdateProgEx.Copy(Config.AtTempPath("setup.exe"));
// Extract update program (the update should be applied using the new version)
C4Group UpdateGroup, SubGroup;
if (!UpdateGroup.Open(strUpdateFile)) return false;
if (!UpdateGroup.Open(strUpdateFile))
{
LogF("Error opening \"%s\": %s", strUpdateFile, UpdateGroup.GetError());
return false;
}
// Look for update program at top level
if (!UpdateGroup.ExtractEntry(strUpdateProg.getData(), strUpdateProgEx.getData()))
{
LogF("Error extracting \"%s\": %s", strUpdateProg.getData(), UpdateGroup.GetError());
return false;
}
#if 0
char strSubGroup[1024+1];
// ASK: What is this? Why should an update program not be found at the top