16.07.2013

New Repository: Delphi-Helpers

I am planning to collect all my little helper units in a single repository.
I'm starting with TSpecialFolder.
  TSpecialFolder = record
  private
    class function GetSpecialFolder(CSIDL: Integer) : string; static;
    class function GetProgramFiles : string; static;
    class function GetProgramFilesX86 : string; static;
    class function GetUserDocuments : string; static;
    class function GetAppData : string; static;
    class function GetCommonAppData : string; static;
    class function getTempPath: string; static;
  public
    class property ProgramFiles : string read GetProgramFiles;
    class property ProgramFilesX86 : string read GetProgramFilesX86;
    class property UserDocuments : string read GetUserDocuments;
    class property UserAppData : string read GetAppData;
    class property CommonAppData : string read GetCommonAppData;
    class property TempPath : string read getTempPath;
  end;

Usage:
procedure Save;
begin
  SaveDialog1.InitialDir := TSpecialFolder.UserDocuments;
  if SaveDialog1.Execute then
  begin
    // Save the file
  end;
end;
You can get the unit from my delphi-helpers git repository https://code.google.com/p/delphi-helpers/

BTW: You can now vote for this blog to be added to DelphiFeeds.com: Vote here

Keine Kommentare: