|
@@ -204,10 +204,11 @@ end;
|
|
|
procedure InitINIFile;
|
|
|
var S: string;
|
|
|
begin
|
|
|
+ IniFilePath:=INIFileName;
|
|
|
S:=LocateFile(INIFileName);
|
|
|
if S<>'' then
|
|
|
- IniFileName:=S;
|
|
|
- IniFileName:=FExpand(IniFileName);
|
|
|
+ IniFilePath:=S;
|
|
|
+ IniFilePath:=FExpand(IniFilePath);
|
|
|
end;
|
|
|
|
|
|
procedure CheckINIFile;
|
|
@@ -215,42 +216,42 @@ var IniDir,CurDir: DirStr;
|
|
|
INI: PINIFile;
|
|
|
const Btns : array[1..2] of string = (btn_config_copyexisting,btn_config_createnew);
|
|
|
begin
|
|
|
- IniDir:=DirOf(IniFileName); CurDir:=GetCurDir;
|
|
|
+ IniDir:=DirOf(IniFilePath); CurDir:=GetCurDir;
|
|
|
if CompareText(IniDir,CurDir)<>0 then
|
|
|
- if not ExistsFile(CurDir+DirInfoName) then
|
|
|
+ if not ExistsFile(CurDir+DirInfoFileName) then
|
|
|
if ConfirmBox(FormatStrStr(msg_doyouwanttocreatelocalconfigfile,IniDir),nil,false)=cmYes then
|
|
|
begin
|
|
|
- if (not ExistsFile(IniFileName)) or
|
|
|
+ if (not ExistsFile(IniFilePath )) or
|
|
|
(ChoiceBox(msg_configcopyexistingorcreatenew,nil,
|
|
|
Btns,false)=cmUserBtn2) then
|
|
|
begin
|
|
|
{ create new config here }
|
|
|
- IniFileName:=CurDir+IniName;
|
|
|
- SwitchesPath:=CurDir+SwitchesName;
|
|
|
+ IniFilePath:=CurDir+IniFileName;
|
|
|
+ SwitchesPath:=CurDir+SwitchesFileName;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
{ copy config here }
|
|
|
- if CopyFile(IniFileName,CurDir+IniName)=false then
|
|
|
- ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+IniName),nil)
|
|
|
+ if CopyFile(IniFilePath,CurDir+IniFileName)=false then
|
|
|
+ ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+IniFileName),nil)
|
|
|
else
|
|
|
- IniFileName:=CurDir+IniName;
|
|
|
+ IniFilePath:=CurDir+IniFileName;
|
|
|
{ copy also SwitchesPath to current dir, but only if
|
|
|
1) SwitchesPath exists
|
|
|
2) SwitchesPath is different from CurDir+SwitchesName }
|
|
|
if ExistsFile(SwitchesPath) and
|
|
|
- not SameFileName(SwitchesPath,CurDir+SwitchesName) then
|
|
|
+ not SameFileName(SwitchesPath,CurDir+SwitchesFileName) then
|
|
|
begin
|
|
|
- if CopyFile(SwitchesPath,CurDir+SwitchesName)=false then
|
|
|
- ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+SwitchesName),nil)
|
|
|
+ if CopyFile(SwitchesPath,CurDir+SwitchesFileName)=false then
|
|
|
+ ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+SwitchesFileName),nil)
|
|
|
else
|
|
|
- SwitchesPath:=CurDir+SwitchesName;
|
|
|
+ SwitchesPath:=CurDir+SwitchesFileName;
|
|
|
end;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
- New(INI, Init(CurDir+DirInfoName));
|
|
|
+ New(INI, Init(CurDir+DirInfoFileName));
|
|
|
INI^.SetEntry(MainSectionName,'Comment','Do NOT delete this file!!!');
|
|
|
if INI^.Update=false then
|
|
|
ErrorBox(FormatStrStr(msg_errorwritingfile,INI^.GetFileName),nil);
|
|
@@ -404,10 +405,10 @@ var INIFile: PINIFile;
|
|
|
W: word;
|
|
|
crcv:cardinal;
|
|
|
begin
|
|
|
- OK:=ExistsFile(IniFileName);
|
|
|
+ OK:=ExistsFile(IniFilePath);
|
|
|
if OK then
|
|
|
begin
|
|
|
- New(INIFile, Init(IniFileName));
|
|
|
+ New(INIFile, Init(IniFilePath));
|
|
|
{ Files }
|
|
|
OpenExts:=INIFile^.GetEntry(secFiles,ieOpenExts,OpenExts);
|
|
|
RecentFileCount:=High(RecentFiles);
|
|
@@ -597,10 +598,10 @@ var INIFile: PINIFile;
|
|
|
OK: boolean;
|
|
|
begin
|
|
|
{$ifdef Unix}
|
|
|
- if not FromSaveAs and (DirOf(IniFileName)=DirOf(SystemIDEDir)) then
|
|
|
+ if not FromSaveAs and (DirOf(IniFilePath)=DirOf(SystemIDEDir)) then
|
|
|
begin
|
|
|
- IniFileName:=FExpand('~/.fp/'+IniName);
|
|
|
- If not ExistsDir(DirOf(IniFileName)) then
|
|
|
+ IniFilePath:=FExpand('~/.fp/'+IniFileName);
|
|
|
+ If not ExistsDir(DirOf(IniFilePath)) then
|
|
|
MkDir(FExpand('~/.fp'));
|
|
|
end;
|
|
|
{$endif Unix}
|
|
@@ -608,12 +609,12 @@ begin
|
|
|
if not FromSaveAs and (DirOf(IniFileName)=DirOf(SystemIDEDir)) and
|
|
|
(GetEnv('APPDATA')<>'') then
|
|
|
begin
|
|
|
- IniFileName:=FExpand(GetEnv('APPDATA')+'/fp/'+IniName);
|
|
|
- If not ExistsDir(DirOf(IniFileName)) then
|
|
|
+ IniFilePath:=FExpand(GetEnv('APPDATA')+'/fp/'+IniFileName);
|
|
|
+ If not ExistsDir(DirOf(IniFilePath)) then
|
|
|
MkDir(FExpand(GetEnv('APPDATA')+'/fp'));
|
|
|
end;
|
|
|
{$endif WINDOWS}
|
|
|
- New(INIFile, Init(IniFileName));
|
|
|
+ New(INIFile, Init(IniFilePath));
|
|
|
{ Files }
|
|
|
{ avoid keeping old files }
|
|
|
INIFile^.DeleteSection(secFiles);
|