installer/UnitPackSystem.pas
changeset 425 8957217cdfba
parent 411 7c1526f514b3
     1.1 --- a/installer/UnitPackSystem.pas	Tue Oct 16 17:57:30 2007 +0000
     1.2 +++ b/installer/UnitPackSystem.pas	Tue Oct 16 18:43:23 2007 +0000
     1.3 @@ -54,6 +54,8 @@
     1.4            { append the compressed file to the destination file }
     1.5            tmpFile := TFileStream.Create('tmp',fmOpenRead);
     1.6            try
     1.7 +            l := tmpFile.Size;
     1.8 +            outfile.WriteBuffer(l, SizeOf(l));
     1.9              outfile.CopyFrom(tmpFile,0);
    1.10            finally
    1.11              tmpFile.Free;
    1.12 @@ -74,7 +76,7 @@
    1.13    dest,s : String;
    1.14    decompr : TDecompressionStream;
    1.15    outfile : TFilestream;
    1.16 -  i,l,c : Integer;
    1.17 +  i,l,lr,c : Integer;
    1.18  begin
    1.19    // IncludeTrailingPathDelimiter (D6/D7 only)
    1.20    dest := IncludeTrailingPathDelimiter(DestDirectory);
    1.21 @@ -88,22 +90,26 @@
    1.22        Stream.Read(l,SizeOf(l));
    1.23        SetLength(s,l);
    1.24        Stream.Read(s[1],l);
    1.25 +      Stream.Read(l,SizeOf(l));
    1.26 +      Stream.Read(lr,SizeOf(lr));
    1.27        { check if this is the right file }
    1.28 -      if ((Pos('.source', s) <> 0) and (Source)) or ((Pos('.orangebox', s) <> 0) and (not Source)) then begin
    1.29 +      if (s = 'hl2launch.exe') or ((Pos('.source', s) <> 0) and (Source)) or ((Pos('.orangebox', s) <> 0) and (not Source)) then begin
    1.30          { remove extension and read filesize }
    1.31 -        s := ChangeFileExt(s, '');
    1.32 -        Stream.Read(l,SizeOf(l));
    1.33 +        if (s <> 'hl2launch.exe') then
    1.34 +          s := ChangeFileExt(s, '');
    1.35          { decompress the files and store it }
    1.36          s := dest+s; //include the path
    1.37          outfile := TFileStream.Create(s,fmCreate);
    1.38 -        decompr := TDecompressionStream.Create(Stream);
    1.39 +        decompr := TDecompressionStream.Create(Stream);   
    1.40          try
    1.41            outfile.CopyFrom(decompr,l);
    1.42          finally
    1.43            outfile.Free;
    1.44            decompr.Free;
    1.45          end;
    1.46 -      end;
    1.47 +      end
    1.48 +      else
    1.49 +        Stream.Position := Stream.Position + lr;
    1.50      end;
    1.51    finally
    1.52      Result := True;
    1.53 @@ -118,6 +124,7 @@
    1.54    Result := False;
    1.55    if not FileExists(AFileName) then
    1.56      Exit;
    1.57 +
    1.58    try
    1.59      aStream := TFileStream.Create(AFileName, fmOpenWrite or fmShareDenyWrite);
    1.60      MemoryStream.Seek(0, soFromBeginning);