View Single Post
  #2  
Old 31-05-2025, 13:41
insertdisc insertdisc is offline
Registered User
 
Join Date: May 2025
Location: Earth
Posts: 12
Thanks: 5
Thanked 1 Time in 1 Post
insertdisc is on a distinguished road
CRC Errors

Quote:
Originally Posted by KaktoR View Post
Looks like a bug. However under normal circumstances you cannot call {app} before the folder is actually initialized by inno setup, but in this case the crc check will start at the very end (I think it's the very last action if you enable all possible options), so I don't know why you get this error. I will ask César if he can fix this.
I changed
Code:
begin
  I := 1;
  SetArrayLength(HashFileList, 0);
  while GetIniString('CRCCheck', 'HashFile' + IntToStr(I), '', ExpandConstant('{tmp}\Settings.ini')) <> '' do
  begin
    HashLine := GetIniString('CRCCheck', 'HashFile' + IntToStr(I), '', ExpandConstant('{tmp}\Settings.ini'));
    if ComponentsCheck(LineDecode(HashLine, 'Comp', '')) and TasksCheck(LineDecode(HashLine, 'Task', '')) and LanguagesCheck(LineDecode(HashLine, 'Lang', '')) then
    begin
      HashFile := ExpandFileName(ExpandConstant(Trim(LineDecode(HashLine, '', ''))));
      if FileExists(HashFile) or (Pos(LowerCase(ExpandConstant('{app}\')), LowerCase(HashFile)) > 0) then
      begin
        Y := GetArrayLength(HashFileList);
        SetArrayLength(HashFileList, Y + 1);
        HashFileList[Y].FileName := GenerateUniqueName(ExpandConstant('{tmp}'), '.dat');
        HashFileList[Y].BasePath := ExpandFileName(ExpandConstant(Trim(LineDecode(HashLine, 'DestDir', '{app}'))));
        HashFileList[Y].AppDirFile := Pos(LowerCase(ExpandConstant('{app}\')), LowerCase(HashFile)) > 0;
        HashFileList[Y].Algorithm := DSG_GetHashAlgorithm(Trim(LineDecode(HashLine, 'Algo', 'auto')));
        if (not HashFileList[Y].AppDirFile) and (not FileCopy(HashFile, HashFileList[Y].FileName, False)) then
          SetArrayLength(HashFileList, Y);
      end;
    end;
to
Code:
begin
  I := 1;
  SetArrayLength(HashFileList, 0);
  while GetIniString('CRCCheck', 'HashFile' + IntToStr(I), '', ExpandConstant('{tmp}\Settings.ini')) <> '' do
  begin
    HashLine := GetIniString('CRCCheck', 'HashFile' + IntToStr(I), '', ExpandConstant('{tmp}\Settings.ini'));
    if ComponentsCheck(LineDecode(HashLine, 'Comp', '')) and TasksCheck(LineDecode(HashLine, 'Task', '')) and LanguagesCheck(LineDecode(HashLine, 'Lang', '')) then
    begin
      HashFile := ExpandFileName(ExpandConstant(Trim(LineDecode(HashLine, '', ''))));
      if FileExists(HashFile) or (Pos(LowerCase(ExpandConstant('{tmp}\')), LowerCase(HashFile)) > 0) then
      begin
        Y := GetArrayLength(HashFileList);
        SetArrayLength(HashFileList, Y + 1);
        HashFileList[Y].FileName := GenerateUniqueName(ExpandConstant('{tmp}'), '.dat');
        HashFileList[Y].BasePath := ExpandFileName(ExpandConstant(Trim(LineDecode(HashLine, 'DestDir', '{app}'))));
        HashFileList[Y].AppDirFile := Pos(LowerCase(ExpandConstant('{tmp}\')), LowerCase(HashFile)) > 0;
        HashFileList[Y].Algorithm := DSG_GetHashAlgorithm(Trim(LineDecode(HashLine, 'Algo', 'auto')));
        if (not HashFileList[Y].AppDirFile) and (not FileCopy(HashFile, HashFileList[Y].FileName, False)) then
          SetArrayLength(HashFileList, Y);
      end;
    end;
and hash completed successfully. Though I'm not sure what long-term implications that would have.
Reply With Quote