diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/UFilesystem.pas | 16 | ||||
-rw-r--r-- | src/base/UPath.pas | 22 |
2 files changed, 23 insertions, 15 deletions
diff --git a/src/base/UFilesystem.pas b/src/base/UFilesystem.pas index d4972df5..805bcfe5 100644 --- a/src/base/UFilesystem.pas +++ b/src/base/UFilesystem.pas @@ -73,9 +73,9 @@ type *} IFileSystem = interface function ExpandFileName(const FileName: IPath): IPath; - function FileCreate(const FileName: IPath): THandle; + function FileCreate(const FileName: IPath): TFileHandle; function DirectoryCreate(const Dir: IPath): boolean; - function FileOpen(const FileName: IPath; Mode: longword): THandle; + function FileOpen(const FileName: IPath; Mode: longword): TFileHandle; function FileAge(const FileName: IPath): integer; overload; function FileAge(const FileName: IPath; out FileDateTime: TDateTime): boolean; overload; @@ -151,9 +151,9 @@ type TFileSystemImpl = class(TInterfacedObject, IFileSystem) public function ExpandFileName(const FileName: IPath): IPath; - function FileCreate(const FileName: IPath): THandle; + function FileCreate(const FileName: IPath): TFileHandle; function DirectoryCreate(const Dir: IPath): boolean; - function FileOpen(const FileName: IPath; Mode: longword): THandle; + function FileOpen(const FileName: IPath; Mode: longword): TFileHandle; function FileAge(const FileName: IPath): integer; overload; function FileAge(const FileName: IPath; out FileDateTime: TDateTime): boolean; overload; function DirectoryExists(const Name: IPath): boolean; @@ -259,7 +259,7 @@ begin Result := Path(WideExpandFileName(FileName.ToWide())); end; -function TFileSystemImpl.FileCreate(const FileName: IPath): THandle; +function TFileSystemImpl.FileCreate(const FileName: IPath): TFileHandle; begin Result := WideFileCreate(FileName.ToWide()); end; @@ -269,7 +269,7 @@ begin Result := WideCreateDir(Dir.ToWide()); end; -function TFileSystemImpl.FileOpen(const FileName: IPath; Mode: longword): THandle; +function TFileSystemImpl.FileOpen(const FileName: IPath; Mode: longword): TFileHandle; begin Result := WideFileOpen(FileName.ToWide(), Mode); end; @@ -431,7 +431,7 @@ begin Result := Path(SysUtils.ExpandFileName(FileName.ToNative())); end; -function TFileSystemImpl.FileCreate(const FileName: IPath): THandle; +function TFileSystemImpl.FileCreate(const FileName: IPath): TFileHandle; begin Result := SysUtils.FileCreate(FileName.ToNative()); end; @@ -441,7 +441,7 @@ begin Result := SysUtils.CreateDir(Dir.ToNative()); end; -function TFileSystemImpl.FileOpen(const FileName: IPath; Mode: longword): THandle; +function TFileSystemImpl.FileOpen(const FileName: IPath; Mode: longword): TFileHandle; begin Result := SysUtils.FileOpen(FileName.ToNative(), Mode); end; diff --git a/src/base/UPath.pas b/src/base/UPath.pas index 3d4804d7..7c00e7b1 100644 --- a/src/base/UPath.pas +++ b/src/base/UPath.pas @@ -46,6 +46,12 @@ uses type
IPath = interface;
+ {$IFDEF FPC}
+ TFileHandle = THandle;
+ {$ELSE}
+ TFileHandle = Longint;
+ {$ENDIF}
+
{**
* TUnicodeMemoryStream
*}
@@ -219,7 +225,7 @@ type * Note: File must be closed with FileClose(Handle) after usage
* @seealso SysUtils.FileOpen()
*}
- function Open(Mode: longword): THandle;
+ function Open(Mode: longword): TFileHandle;
{** @seealso SysUtils.ExtractFileDrive() *}
function GetDrive(): IPath;
@@ -340,8 +346,10 @@ type *}
function FileSearch(const DirList: IPath): IPath;
- {** File must be closed with FileClose(Handle) after usage }
- function CreateFile(): THandle;
+ {**
+ * File must be closed with FileClose(Handle) after usage
+ *}
+ function CreateFile(): TFileHandle;
function DeleteFile(): boolean;
function CreateDirectory(Force: boolean = false): boolean;
function DeleteEmptyDir(): boolean;
@@ -493,7 +501,7 @@ type function ToWide(UseNativeDelim: boolean): WideString;
function ToNative(): RawByteString;
- function Open(Mode: longword): THandle;
+ function Open(Mode: longword): TFileHandle;
function GetDrive(): IPath;
function GetPath(): IPath;
@@ -541,7 +549,7 @@ type function FileSearch(const DirList: IPath): IPath;
- function CreateFile(): THandle;
+ function CreateFile(): TFileHandle;
function DeleteFile(): boolean;
function CreateDirectory(Force: boolean): boolean;
function DeleteEmptyDir(): boolean;
@@ -964,7 +972,7 @@ begin Result := FileSystem.ExcludeTrailingPathDelimiter(Self);
end;
-function TPathImpl.CreateFile(): THandle;
+function TPathImpl.CreateFile(): TFileHandle;
begin
Result := FileSystem.FileCreate(Self);
end;
@@ -977,7 +985,7 @@ begin Result := FileSystem.DirectoryCreate(Self);
end;
-function TPathImpl.Open(Mode: longword): THandle;
+function TPathImpl.Open(Mode: longword): TFileHandle;
begin
Result := FileSystem.FileOpen(Self, Mode);
end;
|