mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 15:20:30 +02:00
Fixed compile on wince. Broken by r43495 #cba214753b (localize special dir)
git-svn-id: trunk@43689 -
This commit is contained in:
parent
1e3565dae3
commit
5fcf1178ec
@ -136,7 +136,7 @@ implementation
|
||||
// to get more detailed error messages consider the os
|
||||
uses
|
||||
{$IFDEF Windows}
|
||||
Windows, WinDirs;
|
||||
Windows {$IFnDEF WinCE}, WinDirs{$ENDIF};
|
||||
{$ELSE}
|
||||
{$IFDEF darwin}
|
||||
MacOSAll,
|
||||
|
@ -21,8 +21,10 @@ var
|
||||
_SetCurrentDirUtf8 : function(const NewDir: String): Boolean;
|
||||
_CreateDirUtf8 : function(const NewDir: String): Boolean;
|
||||
_RemoveDirUtf8 : function(const Dir: String): Boolean ;
|
||||
{$ifndef WinCE}
|
||||
_GetAppConfigDirUTF8 : function(Global: Boolean; Create: boolean = false): string;
|
||||
_GetAppConfigFileUTF8: function(Global: Boolean; SubDir: boolean = false;CreateDir: boolean = false): string;
|
||||
{$endif}
|
||||
|
||||
|
||||
|
||||
@ -127,6 +129,28 @@ begin
|
||||
Result := _FindNextUtf8(Rslt);
|
||||
end;
|
||||
|
||||
{$ifdef WinCE}
|
||||
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;
|
||||
{$else}
|
||||
function GetAppConfigDirUTF8(Global: Boolean; Create: boolean = false): string;
|
||||
begin
|
||||
Result := _GetAppConfigDirUtf8(Global, Create);
|
||||
@ -137,6 +161,7 @@ function GetAppConfigFileUTF8(Global: Boolean; SubDir: boolean;
|
||||
begin
|
||||
Result := _GetAppConfigFileUTF8(Global, SubDir, CreateDir);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
// ******** Start of AnsiString specific implementations ************
|
||||
|
||||
@ -610,6 +635,7 @@ var
|
||||
SHGetFolderPathW : PFNSHGetFolderPathW = Nil;
|
||||
CFGDLLHandle : THandle = 0;
|
||||
|
||||
{$IFnDEF WinCE}
|
||||
Procedure InitDLL;
|
||||
Var
|
||||
pathBuf: array[0..MAX_PATH-1] of char;
|
||||
@ -637,6 +663,7 @@ begin
|
||||
If (@ShGetFolderPathW=Nil) then
|
||||
Raise Exception.Create('Could not determine SHGetFolderPathW Function');
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function GetWindowsSpecialDirW(ID : Integer) : String;
|
||||
Var
|
||||
@ -645,6 +672,7 @@ Var
|
||||
Len: SizeInt;
|
||||
begin
|
||||
Result := '';
|
||||
{$IFnDEF WinCE}
|
||||
if (CFGDLLHandle = 0) then
|
||||
InitDLL;
|
||||
If (SHGetFolderPathW <> Nil) then
|
||||
@ -661,6 +689,7 @@ begin
|
||||
end
|
||||
else
|
||||
Result := SysToUtf8(GetWindowsSpecialDir(ID));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
@ -672,6 +701,7 @@ end;
|
||||
|
||||
function GetAppConfigDirWide(Global: Boolean; Create: boolean = false): string;
|
||||
begin
|
||||
{$IFnDEF WinCE}
|
||||
If Global then
|
||||
Result := GetWindowsSpecialDirW(CSIDL_COMMON_APPDATA)
|
||||
else
|
||||
@ -687,6 +717,9 @@ begin
|
||||
if Result = '' then exit;
|
||||
if Create and not ForceDirectoriesUtf8(Result) then
|
||||
raise EInOutError.Create(Format(lrsUnableToCreateConfigDirectoryS,[Result]));
|
||||
{$ELSE}
|
||||
Result := '';
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function GetAppConfigFileWide(Global: Boolean; SubDir: boolean;
|
||||
@ -1050,8 +1083,10 @@ begin
|
||||
_RemoveDirUtf8 := @RemoveDirWide;
|
||||
_FindFirstUtf8 := @FindFirstWide;
|
||||
_FindNextUtf8 := @FindNextWide;
|
||||
{$ifndef WinCE}
|
||||
_GetAppConfigDirUtf8 := @GetAppConfigDirWide;
|
||||
_GetAppConfigFileUtf8 := @GetAppConfigFileWide;
|
||||
{$endif}
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user