mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Configuration storage
This commit is contained in:
parent
fabcb5ff3d
commit
802d0ea324
3 changed files with 47 additions and 23 deletions
17
fmain.pas
17
fmain.pas
|
|
@ -521,7 +521,7 @@ begin
|
|||
DebugLn('frmMain.Destroy');
|
||||
edtCommand.Items.SaveToFile(gpIniDir+cHistoryFile);
|
||||
{*Tool Bar*}
|
||||
MainToolBar.SaveToFile(gpCfgDir + 'default.bar');
|
||||
MainToolBar.SaveToFile(gpIniDir + 'default.bar');
|
||||
{*Tool Bar*}
|
||||
end;
|
||||
|
||||
|
|
@ -547,7 +547,7 @@ if pmToolBar.Tag >= 0 then
|
|||
if msgYesNo('You really want delete button?') then
|
||||
begin
|
||||
MainToolBar.RemoveButton (pmToolBar.Tag);
|
||||
MainToolBar.SaveToFile(gpCfgDir + 'default.bar');
|
||||
MainToolBar.SaveToFile(gpIniDir + 'default.bar');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
@ -675,7 +675,8 @@ var
|
|||
begin
|
||||
for x:=0 to 4 do
|
||||
gColumnSize[x]:=FrameLeft.dgPanel.ColWidths[x];
|
||||
|
||||
|
||||
SaveGlobs; // must be first
|
||||
(* Save all tabs *)
|
||||
SaveTabs(nbLeft);
|
||||
SaveTabs(nbRight);
|
||||
|
|
@ -753,7 +754,10 @@ begin
|
|||
MainToolBar.ButtonGlyphSize := gToolBarIconSize;
|
||||
MainToolBar.ChangePath := gpExePath;
|
||||
MainToolBar.EnvVar := '%commander_path%';
|
||||
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
|
||||
if FileExists(gpIniDir + 'default.bar') then
|
||||
MainToolBar.LoadFromFile(gpIniDir + 'default.bar')
|
||||
else
|
||||
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
|
||||
end;
|
||||
(*Tool Bar*)
|
||||
|
||||
|
|
@ -2668,7 +2672,10 @@ begin
|
|||
begin
|
||||
MainToolBar.ChangePath := gpExePath;
|
||||
MainToolBar.EnvVar := '%commander_path%';
|
||||
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
|
||||
if FileExists(gpIniDir + 'default.bar') then
|
||||
MainToolBar.LoadFromFile(gpIniDir + 'default.bar')
|
||||
else
|
||||
MainToolBar.LoadFromFile(gpCfgDir + 'default.bar');
|
||||
MainToolBar.Visible := gButtonBar;
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ procedure LoadPaths;
|
|||
|
||||
implementation
|
||||
uses
|
||||
LCLProc, SysUtils;
|
||||
LCLProc, SysUtils, IniFiles;
|
||||
|
||||
function GetAppName : String;
|
||||
begin
|
||||
|
|
@ -21,18 +21,30 @@ begin
|
|||
end;
|
||||
|
||||
procedure LoadPaths;
|
||||
var
|
||||
Ini : TIniFile;
|
||||
begin
|
||||
OnGetApplicationName := @GetAppName;
|
||||
gpIniDir := GetAppConfigDir(False);
|
||||
if not DirectoryExists(gpIniDir) then
|
||||
ForceDirectories(gpIniDir);
|
||||
OnGetApplicationName := nil;
|
||||
gpIniDir := IncludeTrailingPathDelimiter(gpIniDir); // add if need path delimiter
|
||||
|
||||
gpExePath := ExtractFilePath(ParamStr(0));
|
||||
DebugLn('Executable directory: ', gpExePath);
|
||||
|
||||
|
||||
gpCfgDir := gpExePath;
|
||||
|
||||
Ini := TIniFile.Create(gpCfgDir + 'doublecmd.ini');
|
||||
if Ini.ReadInteger('Configuration', 'UseIniInProgramDir', 1) = 1 then // use ini file from program dir
|
||||
begin
|
||||
gpIniDir := gpCfgDir;
|
||||
end
|
||||
else
|
||||
begin
|
||||
OnGetApplicationName := @GetAppName;
|
||||
gpIniDir := GetAppConfigDir(False);
|
||||
if not DirectoryExists(gpIniDir) then
|
||||
ForceDirectories(gpIniDir);
|
||||
OnGetApplicationName := nil;
|
||||
gpIniDir := IncludeTrailingPathDelimiter(gpIniDir); // add if need path delimiter
|
||||
end;
|
||||
Ini.Free;
|
||||
|
||||
gpLngDir := gpExePath + 'language' + DirectorySeparator;
|
||||
gpPixmapPath := gpExePath + 'pixmaps' + DirectorySeparator;
|
||||
end;
|
||||
|
|
|
|||
23
uglobs.pas
23
uglobs.pas
|
|
@ -10,7 +10,7 @@ Globals variables and some consts
|
|||
|
||||
contributors:
|
||||
|
||||
Copyright (C) 2006-2007 Alexander Koblov (Alexx2000@mail.ru)
|
||||
Copyright (C) 2006-2008 Alexander Koblov (Alexx2000@mail.ru)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +191,11 @@ end;
|
|||
|
||||
procedure InitGlobs;
|
||||
begin
|
||||
gIni:=TIniFile.Create(gpCfgDir + 'doublecmd.ini');
|
||||
if gIni.ReadInteger('Configuration', 'UseIniInProgramDir', 1) = 0 then
|
||||
begin
|
||||
gIni.Free;
|
||||
gIni:=TIniFile.Create(gpIniDir + 'doublecmd.ini');
|
||||
end;
|
||||
if FileExists(gpIniDir + 'doublecmd.ini') then
|
||||
gIni := TIniFile.Create(gpIniDir + 'doublecmd.ini')
|
||||
else
|
||||
gIni := TIniFile.Create(gpCfgDir + 'doublecmd.ini');
|
||||
|
||||
gExts := TExts.Create;
|
||||
gColorExt := TColorExt.Create;
|
||||
glsHotDir := TStringList.Create;
|
||||
|
|
@ -346,7 +345,13 @@ var
|
|||
begin
|
||||
glsDirHistory.SaveToFile(gpIniDir + 'dirhistory.txt');
|
||||
glsMaskHistory.SaveToFile(gpIniDir + 'maskhistory.txt');
|
||||
|
||||
|
||||
if gIni.FileName <> gpIniDir + 'doublecmd.ini' then
|
||||
begin
|
||||
gIni.Free;
|
||||
gIni := TIniFile.Create(gpIniDir + 'doublecmd.ini');
|
||||
end;
|
||||
|
||||
{Layout page}
|
||||
|
||||
gIni.WriteBool('Layout', 'ButtonBar', gButtonBar);
|
||||
|
|
@ -420,5 +425,5 @@ end;
|
|||
initialization
|
||||
|
||||
finalization
|
||||
SaveGlobs;
|
||||
|
||||
end.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue