Changeset 12 for trunk/Packages/Common


Ignore:
Timestamp:
Apr 2, 2016, 11:08:30 AM (9 years ago)
Author:
chronos
Message:
  • Added: Available block drives detection under Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UCommon.pas

    r4 r12  
    6565procedure FreeThenNil(var Obj);
    6666function RemoveQuotes(Text: string): string;
     67function LoadFileToStr(const FileName: TFileName): AnsiString;
    6768
    6869
     
    448449end;
    449450
     451function LoadFileToStr(const FileName: TFileName): AnsiString;
     452var
     453  FileStream: TFileStream;
     454  Read: Integer;
     455begin
     456  Result := '';
     457  FileStream := TFileStream.Create(FileName, fmOpenRead);
     458  try
     459    if FileStream.Size > 0 then begin
     460      SetLength(Result, FileStream.Size);
     461      Read := FileStream.Read(Pointer(Result)^, FileStream.Size);
     462      SetLength(Result, Read);
     463    end;
     464  finally
     465    FileStream.Free;
     466  end;
     467end;
    450468
    451469initialization
Note: See TracChangeset for help on using the changeset viewer.