|
@@ -23,16 +23,30 @@
|
|
|
|
|
|
|
|
|
|
{$ifndef OS_FILEISREADONLY}
|
|
{$ifndef OS_FILEISREADONLY}
|
|
|
|
+{$ifdef FPC_UNICODE_RTL}
|
|
|
|
+ Function FileIsReadOnly(const FileName: RawByteString): Boolean;
|
|
|
|
+{$else}
|
|
Function FileIsReadOnly(const FileName: String): Boolean;
|
|
Function FileIsReadOnly(const FileName: String): Boolean;
|
|
|
|
+{$endif}
|
|
|
|
+ begin
|
|
|
|
+ Result := (FileGetAttr(FileName) and faReadOnly) <> 0;
|
|
|
|
+ end;
|
|
|
|
+ {$ifdef FPC_UNICODE_RTL}
|
|
|
|
+ Function FileIsReadOnly(const FileName: UnicodeString): Boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result := (FileGetAttr(FileName) and faReadOnly) <> 0;
|
|
Result := (FileGetAttr(FileName) and faReadOnly) <> 0;
|
|
end;
|
|
end;
|
|
|
|
+ {$endif}
|
|
{$endif OS_FILEISREADONLY}
|
|
{$endif OS_FILEISREADONLY}
|
|
|
|
|
|
|
|
|
|
{$ifndef OS_FILESETDATEBYNAME}
|
|
{$ifndef OS_FILESETDATEBYNAME}
|
|
|
|
+ {$ifdef FPC_UNICODE_RTL}
|
|
|
|
+ Function FileSetDate (Const FileName : RawByteString;Age : Longint) : Longint;
|
|
|
|
+ {$else}
|
|
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
|
|
Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
|
|
|
|
+ {$endif}
|
|
Var
|
|
Var
|
|
fd : THandle;
|
|
fd : THandle;
|
|
begin
|
|
begin
|
|
@@ -51,6 +65,27 @@
|
|
Result:=-1;
|
|
Result:=-1;
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
+ {$ifdef FPC_UNICODE_RTL}
|
|
|
|
+ Function FileSetDate (Const FileName : UnicodeString;Age : Longint) : Longint;
|
|
|
|
+ Var
|
|
|
|
+ fd : THandle;
|
|
|
|
+ begin
|
|
|
|
+ { at least windows requires fmOpenWrite here }
|
|
|
|
+ fd:=FileOpen(FileName,fmOpenWrite);
|
|
|
|
+ If (Fd<>feInvalidHandle) then
|
|
|
|
+ try
|
|
|
|
+ Result:=FileSetDate(fd,Age);
|
|
|
|
+ finally
|
|
|
|
+ FileClose(fd);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ {$ifdef HAS_OSERROR}
|
|
|
|
+ Result:=GetLastOSError;
|
|
|
|
+ {$else}
|
|
|
|
+ Result:=-1;
|
|
|
|
+ {$endif}
|
|
|
|
+ end;
|
|
|
|
+ {$endif}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
{ Read String Handling functions implementation }
|
|
{ Read String Handling functions implementation }
|
|
@@ -712,7 +747,7 @@ function GetModuleName(Module: HMODULE): string;
|
|
begin
|
|
begin
|
|
{$ifdef MSWINDOWS}
|
|
{$ifdef MSWINDOWS}
|
|
SetLength(Result,MAX_PATH);
|
|
SetLength(Result,MAX_PATH);
|
|
- SetLength(Result,GetModuleFileName(Module, Pchar(Result),Length(Result)));
|
|
|
|
|
|
+ SetLength(Result,GetModuleFileNameA(Module, Pchar(Result),Length(Result)));
|
|
{$ELSE}
|
|
{$ELSE}
|
|
Result:='';
|
|
Result:='';
|
|
{$ENDIF}
|
|
{$ENDIF}
|