{----------------------------------------------------------------------------- Unit Name: Folder Author: vesal Purpose: Keep information of current folder. The folder information is read from ininame History: -----------------------------------------------------------------------------} unit Folder; interface type TFolder = class private FPath: string; FTitle: string; FIniName : string; FSmallerDir: string; function GetName: string; procedure SetTitle(const Value: string); procedure SetSmallerDir(const Value: string); protected procedure Write(Sec,item,Value:string); public constructor Create(name,ininame:string); property Path:string read FPath; property Name : string read GetName; property Title:string read FTitle write SetTitle; property SmallerDir : string read FSmallerDir write SetSmallerDir; end; implementation uses IniFiles,SysUtils; { TFolder } constructor TFolder.Create(name,ininame: string); var ini : TIniFile; begin ini := TIniFile.Create(name+'\'+ininame); Fininame := ini.FileName; FPath := name; FTitle := ini.ReadString('Title','Title',ExtractFileName(name)); FSmallerDir := ini.ReadString('Options','SmallerDir',''); ini.Free; end; function TFolder.GetName: string; begin Result := ExtractFileName(Path); end; procedure TFolder.SetSmallerDir(const Value: string); begin FSmallerDir := Value; Write('Options','SmallerDir',Value); end; procedure TFolder.SetTitle(const Value: string); begin FTitle := Value; Write('Title','Title',Value); end; procedure TFolder.Write(Sec, item, Value: string); var ini : TIniFile; begin ini := TIniFile.Create(Fininame); ini.WriteString(Sec,item,Value); ini.Free; end; end.