diff --git a/UConfig.pas b/UConfig.pas index 9ee6f16..a878bb9 100644 --- a/UConfig.pas +++ b/UConfig.pas @@ -800,6 +800,9 @@ end; (********************************************************************************************************************************) procedure ReadMounter; var s: string; + MountDir: string; + Handle: PDIR; + DirEnt: PDirent64; IniFile: TMyIniFile; Sections: TStringList; i: integer; @@ -847,6 +850,38 @@ begin InternalMounterConfmtime := GetFileTime(IncludeTrailingPathDelimiter(s) + 'mounter'); end; except end; + MountDir := IncludeTrailingPathDelimiter(s) + 'mounters'; + if DirectoryExists(MountDir) then begin + Handle := opendir(PChar(MountDir)); + repeat + DirEnt := readdir64(Handle); + if not (DirEnt = nil) then begin + IniFile := TMyIniFile.Create(IncludeTrailingPathDelimiter(MountDir) + string(PChar(@DirEnt^.d_name[0])), True); + try + Sections := TStringList.Create; + IniFile.ReadSections(Sections); + if Sections.Count > 0 then + for i := 0 to Sections.Count - 1 do + begin + Item := TMounterItem.Create; + with Item do + begin + Device := Sections[i]; + DisplayText := IniFile.ReadString(Sections[i], 'DisplayText', ''); + MountPath := IniFile.ReadString(Sections[i], 'MountPath', ''); + IconPath := IniFile.ReadString(Sections[i], 'IconPath', ''); + MountCommand := IniFile.ReadString(Sections[i], 'MountCommand', ''); + UmountCommand := IniFile.ReadString(Sections[i], 'UmountCommand', ''); + DeviceType := IniFile.ReadInteger(Sections[i], 'DeviceType', 0); + end; + MounterList.Add(Item); + end; + Sections.Free; + except end; + end; + until DirEnt = nil; + closedir(Handle); + end; end; procedure WriteMounter;