From aecd412bef5a839a34617f11ba2fdf247d086584 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 19 Apr 2010 17:43:55 +0000 Subject: changed THandle to TFileHandle in UPath/UFilesystem as THandle (cardinal in delphi) does not allow -1. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2251 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UPath.pas | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/base/UPath.pas') 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; -- cgit v1.2.3