mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 12:09:32 +02:00
LazUtils: Move GetAppConfigDirUTF8 and GetAppConfigFileUTF8 to LazFileUtils (and inline them in FileUtil).
Part of the ongoing restructuring of LazUtils. git-svn-id: trunk@41589 -
This commit is contained in:
parent
555ede86aa
commit
7ac6639fb4
@ -198,23 +198,13 @@ end;
|
||||
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
begin
|
||||
Result:=SysToUTF8(SysUtils.GetAppConfigDir(Global));
|
||||
if Result='' then exit;
|
||||
if Create and not ForceDirectoriesUTF8(Result) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Result]));
|
||||
Result := LazFileUtils.GetAppConfigDirUTF8(Global, Create);
|
||||
end;
|
||||
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean;
|
||||
CreateDir: boolean): string;
|
||||
var
|
||||
Dir: string;
|
||||
begin
|
||||
Result:=SysToUTF8(SysUtils.GetAppConfigFile(Global,SubDir));
|
||||
if not CreateDir then exit;
|
||||
Dir:=ExtractFilePath(Result);
|
||||
if Dir='' then exit;
|
||||
if not ForceDirectoriesUTF8(Dir) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Dir]));
|
||||
Result := LazFileUtils.GetAppConfigFileUTF8(Global, SubDir, CreateDir);
|
||||
end;
|
||||
|
||||
function SysErrorMessageUTF8(ErrorCode: Integer): String;
|
||||
|
@ -264,9 +264,9 @@ function FileCreateUTF8(Const FileName : string; Rights: Cardinal) : THandle; ov
|
||||
function ParamStrUTF8(Param: Integer): string; inline;
|
||||
function GetEnvironmentStringUTF8(Index: Integer): string; inline;
|
||||
function GetEnvironmentVariableUTF8(const EnvVar: string): String; inline;
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string; inline;
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false;
|
||||
CreateDir: boolean = false): string;
|
||||
CreateDir: boolean = false): string; inline;
|
||||
|
||||
// other
|
||||
function SysErrorMessageUTF8(ErrorCode: Integer): String; inline;
|
||||
|
@ -99,6 +99,10 @@ Function FileCreateUtf8(Const FileName : String; ShareMode : Integer; Rights : C
|
||||
|
||||
function FileSizeUtf8(const Filename: string): int64;
|
||||
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean = false;
|
||||
CreateDir: boolean = false): string;
|
||||
|
||||
|
||||
// UNC paths
|
||||
function IsUNCPath(const {%H-}Path: String): Boolean;
|
||||
@ -884,7 +888,26 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
begin
|
||||
Result:=SysToUTF8(SysUtils.GetAppConfigDir(Global));
|
||||
if Result='' then exit;
|
||||
if Create and not ForceDirectoriesUTF8(Result) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Result]));
|
||||
end;
|
||||
|
||||
function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean;
|
||||
CreateDir: boolean): string;
|
||||
var
|
||||
Dir: string;
|
||||
begin
|
||||
Result:=SysToUTF8(SysUtils.GetAppConfigFile(Global,SubDir));
|
||||
if not CreateDir then exit;
|
||||
Dir:=ExtractFilePath(Result);
|
||||
if Dir='' then exit;
|
||||
if not ForceDirectoriesUTF8(Dir) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Dir]));
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user