RxFPC:fix file name for TRxXMLPropStorage

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6166 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-02-02 10:30:25 +00:00
parent 992be28e62
commit cf916d308e

View File

@@ -48,6 +48,7 @@ type
TRxXMLPropStorage = class(TXMLPropStorage) TRxXMLPropStorage = class(TXMLPropStorage)
private private
FSeparateFiles: boolean; FSeparateFiles: boolean;
function FixPath2(const APath: String): String;
protected protected
function GetXMLFileName: string; override; function GetXMLFileName: string; override;
public public
@@ -60,19 +61,24 @@ type
implementation implementation
uses LazFileUtils, LazUTF8, rxapputils; uses LazFileUtils, LazUTF8, rxapputils;
function GetDefaultCfgName: string; function GetDefaultCfgName: string;
var var
S:string; S:string;
begin begin
Result := ExtractFileName(ChangeFileExt(Application.ExeName, defCFGFileExt)); Result := ExtractFileName(ChangeFileExt(Application.ExeName, defCFGFileExt));
S:=RxGetAppConfigDir(false); S:=SysToUTF8(RxGetAppConfigDir(false));
S:=SysToUTF8(S);
ForceDirectoriesUTF8(S); ForceDirectoriesUTF8(S);
Result:=S+Result; Result:=S+Result;
end; end;
{ TRxXMLPropStorage } { TRxXMLPropStorage }
function TRxXMLPropStorage.FixPath2(const APath: String): String;
begin
Result:=StringReplace(APath,'/', '.', [rfReplaceAll]);
end;
function TRxXMLPropStorage.GetXMLFileName: string; function TRxXMLPropStorage.GetXMLFileName: string;
var var
S: String; S: String;
@@ -81,13 +87,13 @@ begin
Result:=FileName Result:=FileName
else else
begin begin
S:=GetDefaultIniName; S:=GetDefaultCfgName;
if FileName <> '' then if FileName <> '' then
Result:=AppendPathDelim(ExtractFileDir(S)) + FileName Result:=AppendPathDelim(ExtractFileDir(S)) + FileName
else else
begin begin
if FSeparateFiles then if FSeparateFiles then
Result:=AppendPathDelim(ExtractFileDir(S)) + RootSection + defCFGFileExt Result:=AppendPathDelim(ExtractFileDir(S)) + FixPath2(RootSection) + defCFGFileExt
else else
Result:=S; Result:=S;
end; end;