Browse Source

* (fairly minimal) differences from windows rtl to parts from *nix rtl.

git-svn-id: branches/unicode@24717 -
marco 12 năm trước cách đây
mục cha
commit
8a316077bb
2 tập tin đã thay đổi với 37 bổ sung2 xóa
  1. 1 1
      rtl/objpas/sysutils/fina.inc
  2. 36 1
      rtl/objpas/sysutils/sysutils.inc

+ 1 - 1
rtl/objpas/sysutils/fina.inc

@@ -121,7 +121,7 @@ function ExtractShortPathName(Const FileName : String) : String;
 begin
 {$ifdef MSWINDOWS}
   SetLength(Result,Max_Path);
-  SetLength(Result,GetShortPathName(PChar(FileName), Pchar(Result),Length(Result)));
+  SetLength(Result,GetShortPathNameA(PChar(FileName), Pchar(Result),Length(Result)));
 {$else}
   Result:=FileName;
 {$endif}

+ 36 - 1
rtl/objpas/sysutils/sysutils.inc

@@ -23,16 +23,30 @@
 
 
   {$ifndef OS_FILEISREADONLY}
+{$ifdef FPC_UNICODE_RTL}
+  Function FileIsReadOnly(const FileName: RawByteString): Boolean;
+{$else}
   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
     Result := (FileGetAttr(FileName) and faReadOnly) <> 0;
   end;
+  {$endif}
   {$endif OS_FILEISREADONLY}
 
 
   {$ifndef OS_FILESETDATEBYNAME}
+  {$ifdef FPC_UNICODE_RTL}
+  Function FileSetDate (Const FileName : RawByteString;Age : Longint) : Longint;
+  {$else}
   Function FileSetDate (Const FileName : String;Age : Longint) : Longint;
+  {$endif}
   Var
     fd : THandle;
   begin
@@ -51,6 +65,27 @@
       Result:=-1;
   {$endif}
   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}
 
   { Read String Handling functions implementation }
@@ -712,7 +747,7 @@ function GetModuleName(Module: HMODULE): string;
 begin
 {$ifdef MSWINDOWS}
   SetLength(Result,MAX_PATH);
-  SetLength(Result,GetModuleFileName(Module, Pchar(Result),Length(Result)));
+  SetLength(Result,GetModuleFileNameA(Module, Pchar(Result),Length(Result)));
 {$ELSE}
   Result:='';
 {$ENDIF}