Преглед изворни кода

Firemonkey OSX, IOS & Delphi Linux compatibility

Unknown пре 6 година
родитељ
комит
f3148d2ee2
7 измењених фајлова са 255 додато и 57 уклоњено
  1. 43 10
      Quick.Commons.pas
  2. 134 11
      Quick.Console.pas
  3. 61 31
      Quick.Files.pas
  4. 6 2
      Quick.Log.pas
  5. 2 2
      Quick.SyncObjs.Linux.Compatibility.pas
  6. 6 0
      Quick.SysInfo.pas
  7. 3 1
      Quick.Threads.pas

+ 43 - 10
Quick.Commons.pas

@@ -5,9 +5,9 @@
   Unit        : Quick.Commons
   Unit        : Quick.Commons
   Description : Common functions
   Description : Common functions
   Author      : Kike Pérez
   Author      : Kike Pérez
-  Version     : 1.5
+  Version     : 1.7
   Created     : 14/07/2017
   Created     : 14/07/2017
-  Modified    : 24/01/2019
+  Modified    : 16/02/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -70,6 +70,9 @@ interface
     FMX.Helpers.Mac,
     FMX.Helpers.Mac,
     Macapi.ObjectiveC,
     Macapi.ObjectiveC,
     {$ENDIF}
     {$ENDIF}
+    {$IFDEF POSIX}
+    Posix.Unistd,
+    {$ENDIF}
     DateUtils;
     DateUtils;
 
 
 type
 type
@@ -732,7 +735,11 @@ function GetLoggedUserName : string;
   end;
   end;
   {$ELSE}
   {$ELSE}
   begin
   begin
+    {$IFDEF POSIX}
+    Result := string(getlogin);
+    {$ELSE}
     Result := 'N/A';
     Result := 'N/A';
+    {$ENDIF}
     //raise ENotImplemented.Create('Not Android GetLoggedUserName implemented!');
     //raise ENotImplemented.Create('Not Android GetLoggedUserName implemented!');
   end;
   end;
   {$ENDIF}
   {$ENDIF}
@@ -766,22 +773,38 @@ function GetComputerName : string;
     Result := pchar(result);
     Result := pchar(result);
   end;
   end;
 {$ELSE}
 {$ELSE}
-  {$IF DEFINED(FPC) OR DEFINED(LINUX)}
+  {$IF DEFINED(FPC) AND DEFINED(LINUX)}
   begin
   begin
     Result := GetEnvironmentVariable('COMPUTERNAME');
     Result := GetEnvironmentVariable('COMPUTERNAME');
   end;
   end;
   {$ELSE} //Android gets model name
   {$ELSE} //Android gets model name
-  begin
     {$IFDEF NEXTGEN}
     {$IFDEF NEXTGEN}
+    begin
       {$IFDEF ANDROID}
       {$IFDEF ANDROID}
       Result := JStringToString(TJBuild.JavaClass.MODEL);
       Result := JStringToString(TJBuild.JavaClass.MODEL);
       {$ELSE} //IOS
       {$ELSE} //IOS
       Result := GetDeviceModel;
       Result := GetDeviceModel;
       {$ENDIF}
       {$ENDIF}
-    {$ELSE} //OSX
-    Result := NSStrToStr(TNSHost.Wrap(TNSHost.OCClass.currentHost).localizedName);
+    end;
+    {$ELSE}
+      {$IFDEF DELPHILINUX}
+      var
+        puser : PAnsiChar;
+      begin
+        //puser := '';
+        try
+          if gethostname(puser,_SC_HOST_NAME_MAX) = 0 then Result := string(puser)
+            else Result := 'N/A';
+        except
+          Result := 'N/A';
+        end;
+      end;
+      {$ELSE} //OSX
+      begin
+        Result := NSStrToStr(TNSHost.Wrap(TNSHost.OCClass.currentHost).localizedName);
+      end;
+      {$ENDIF}
     {$ENDIF}
     {$ENDIF}
-  end;
   {$ENDIF}
   {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
@@ -944,9 +967,13 @@ end;
           Result := UTF8ToString(BuildStr.UTF8String);
           Result := UTF8ToString(BuildStr.UTF8String);
 
 
         except
         except
-          Result := 'N/A';
+          Result := '';
         end;
         end;
       end;
       end;
+      {$ELSE}
+        begin
+          Result := '';
+        end;
       {$ENDIF}
       {$ENDIF}
     {$ENDIF}
     {$ENDIF}
   {$ENDIF}
   {$ENDIF}
@@ -1025,8 +1052,9 @@ end;
         Result := UTF8ToString(BuildStr.UTF8String);
         Result := UTF8ToString(BuildStr.UTF8String);
       end;
       end;
       {$ENDIF}
       {$ENDIF}
-    {$ELSE} //OSX
-    var
+    {$ELSE}
+      {$IFDEF OSX}
+      var
         AppKey: Pointer;
         AppKey: Pointer;
         AppBundle: NSBundle;
         AppBundle: NSBundle;
         BuildStr : NSString;
         BuildStr : NSString;
@@ -1036,6 +1064,11 @@ end;
         BuildStr := TNSString.Wrap(AppBundle.infoDictionary.objectForKey(AppKey));
         BuildStr := TNSString.Wrap(AppBundle.infoDictionary.objectForKey(AppKey));
         Result := UTF8ToString(BuildStr.UTF8String);
         Result := UTF8ToString(BuildStr.UTF8String);
       end;
       end;
+      {$ELSE}
+        begin
+          Result := 'N/A';
+        end;
+      {$ENDIF}
     {$ENDIF}
     {$ENDIF}
   {$ENDIF}
   {$ENDIF}
 {$ENDIF}
 {$ENDIF}

+ 134 - 11
Quick.Console.pas

@@ -1,13 +1,13 @@
 { ***************************************************************************
 { ***************************************************************************
 
 
-  Copyright (c) 2016-2018 Kike Pérez
+  Copyright (c) 2016-2019 Kike Pérez
 
 
   Unit        : Quick.Console
   Unit        : Quick.Console
   Description : Console output with colors and optional file log
   Description : Console output with colors and optional file log
   Author      : Kike Pérez
   Author      : Kike Pérez
-  Version     : 1.8
+  Version     : 1.9
   Created     : 10/05/2017
   Created     : 10/05/2017
-  Modified    : 09/03/2018
+  Modified    : 17/02/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -59,6 +59,7 @@ uses
   {$ENDIF}
   {$ENDIF}
   {$IFDEF DELPHILINUX}
   {$IFDEF DELPHILINUX}
   Quick.SyncObjs.Linux.Compatibility,
   Quick.SyncObjs.Linux.Compatibility,
+  Posix.StdDef,
   {$ENDIF}
   {$ENDIF}
   SysUtils,
   SysUtils,
   Quick.Commons,
   Quick.Commons,
@@ -67,6 +68,7 @@ uses
 type
 type
 
 
   //text colors
   //text colors
+  {$IFNDEF DELPHILINUX}
   TConsoleColor = (
   TConsoleColor = (
   ccBlack        = 0,
   ccBlack        = 0,
   ccBlue         = 1,
   ccBlue         = 1,
@@ -84,6 +86,25 @@ type
   ccLightMagenta = 13,
   ccLightMagenta = 13,
   ccYellow       = 14,
   ccYellow       = 14,
   ccWhite        = 15);
   ccWhite        = 15);
+  {$ELSE}
+  TConsoleColor = (
+  ccDarkGray     = 90,
+  ccLightRed     = 91,
+  ccLightGreen   = 92,
+  ccYellow       = 93,
+  ccLightBlue    = 94,
+  ccLightMagenta = 95,
+  ccLightCyan    = 96,
+  ccWhite        = 97,
+  ccBlack        = 30,
+  ccRed          = 31,
+  ccGreen        = 32,
+  ccBrown        = 33,
+  ccBlue         = 34,
+  ccMagenta      = 35,
+  ccCyan         = 36,
+  ccLightGray    = 37);
+  {$ENDIF}
 
 
   TConsoleProperties = record
   TConsoleProperties = record
     LogVerbose : TLogVerbose;
     LogVerbose : TLogVerbose;
@@ -171,9 +192,20 @@ type
   procedure ClearLine(Y : Integer); overload;
   procedure ClearLine(Y : Integer); overload;
   procedure ShowCursor;
   procedure ShowCursor;
   procedure HideCursor;
   procedure HideCursor;
+  {$IFDEF DELPHILINUX}
+  procedure SaveCursor;
+  procedure RestoreCursor;
+  procedure CursorOn;
+  procedure CursorOff;
+  function ReadKey : Char;
+  {$ELSE}
   function GetCursorX: Integer; {$IFDEF INLINES}inline;{$ENDIF}
   function GetCursorX: Integer; {$IFDEF INLINES}inline;{$ENDIF}
   function GetCursorY: Integer; {$IFDEF INLINES}inline;{$ENDIF}
   function GetCursorY: Integer; {$IFDEF INLINES}inline;{$ENDIF}
+  {$ENDIF}
   function GetCursorMaxBottom : Integer;
   function GetCursorMaxBottom : Integer;
+  {$IFDEF DELPHILINUX}
+  procedure GotoXY(x,y : Integer);
+  {$ENDIF}
   procedure SetCursorPos(NewCoord : TCoord); overload;
   procedure SetCursorPos(NewCoord : TCoord); overload;
   procedure SetCursorPos(x ,y : Integer); overload;
   procedure SetCursorPos(x ,y : Integer); overload;
   {$IFDEF MSWINDOWS}
   {$IFDEF MSWINDOWS}
@@ -203,6 +235,14 @@ var
 implementation
 implementation
 
 
 
 
+{$IFDEF DELPHILINUX}
+const
+  AEC =chr($1B)+chr($5b);
+  SAVE_CURSOR_POS = chr($1B) + '7';
+  RESTORE_CURSOR_POS = chr($1B) + '8';
+{$ENDIF}
+
+
 procedure cout(const cMsg : Integer; cEventType : TLogEventType);
 procedure cout(const cMsg : Integer; cEventType : TLogEventType);
 var
 var
   FmtSets : TFormatSettings;
   FmtSets : TFormatSettings;
@@ -286,6 +326,33 @@ begin
   cout(Format(cMsg,params),cEventType);
   cout(Format(cMsg,params),cEventType);
 end;
 end;
 
 
+{$IFDEF DELPHILINUX}
+procedure SaveCursor;
+begin
+  write(SAVE_CURSOR_POS);
+end;
+
+procedure RestoreCursor;
+begin
+  write(RESTORE_CURSOR_POS);
+end;
+
+procedure CursorOn;
+begin
+  //not implemented yet
+end;
+
+procedure CursorOff;
+begin
+  //not implemented yet
+end;
+
+function ReadKey : Char;
+begin
+  Read(Result);
+end;
+
+{$ELSE}
 function GetCursorX: Integer; {$IFDEF INLINES}inline;{$ENDIF}
 function GetCursorX: Integer; {$IFDEF INLINES}inline;{$ENDIF}
 {$IFDEF MSWINDOWS}
 {$IFDEF MSWINDOWS}
 var
 var
@@ -296,7 +363,11 @@ begin
 end;
 end;
 {$ELSE}
 {$ELSE}
 begin
 begin
+  {$IFDEF FPC}
   Result := WhereX;
   Result := WhereX;
+  {$ELSE}
+  Result := Byte(ConData(CD_CURRX))-lo(windmin);
+  {$ENDIF}
 end;
 end;
 {$ENDIF}
 {$ENDIF}
 
 
@@ -313,6 +384,7 @@ begin
   Result := WhereY;
   Result := WhereY;
 end;
 end;
 {$ENDIF}
 {$ENDIF}
+{$ENDIF DELPHILINUX}
 
 
 function GetCursorMaxBottom : Integer;
 function GetCursorMaxBottom : Integer;
 {$IFDEF MSWINDOWS}
 {$IFDEF MSWINDOWS}
@@ -324,7 +396,14 @@ begin
 end;
 end;
 {$ELSE}
 {$ELSE}
 begin
 begin
-  Result := 80;
+  Result := 25;
+end;
+{$ENDIF}
+
+{$IFDEF DELPHILINUX}
+procedure GotoXY(x,y : Integer);
+begin
+  Write(AEC, y, ';', x, 'H');
 end;
 end;
 {$ENDIF}
 {$ENDIF}
 
 
@@ -354,8 +433,12 @@ begin
   {$IFDEF MSWINDOWS}
   {$IFDEF MSWINDOWS}
   if hStdOut = 0 then Exit;
   if hStdOut = 0 then Exit;
   {$ENDIF}
   {$ENDIF}
+  {$IFNDEF DELPHILINUX}
   LastCoord.X := GetCursorX;
   LastCoord.X := GetCursorX;
   LastCoord.Y := GetCursorY;
   LastCoord.Y := GetCursorY;
+  {$ELSE}
+  write(SAVE_CURSOR_POS);
+  {$ENDIF}
   NewCoord.X := x;
   NewCoord.X := x;
   NewCoord.Y := y;
   NewCoord.Y := y;
   ClearLine(Y);
   ClearLine(Y);
@@ -363,7 +446,11 @@ begin
   try
   try
     cout(cMsg,cEventType);
     cout(cMsg,cEventType);
   finally
   finally
+    {$IFNDEF DELPHILINUX}
     SetCursorPos(LastCoord);
     SetCursorPos(LastCoord);
+    {$ELSE}
+    write(RESTORE_CURSOR_POS);
+    {$ENDIF}
   end;
   end;
 end;
 end;
 
 
@@ -375,8 +462,12 @@ begin
   {$IFDEF MSWINDOWS}
   {$IFDEF MSWINDOWS}
   if hStdOut = 0 then Exit;
   if hStdOut = 0 then Exit;
   {$ENDIF}
   {$ENDIF}
+  {$IFNDEF DELPHILINUX}
   LastCoord.X := GetCursorX;
   LastCoord.X := GetCursorX;
   LastCoord.Y := GetCursorY;
   LastCoord.Y := GetCursorY;
+  {$ELSE}
+  write(SAVE_CURSOR_POS);
+  {$ENDIF}
   NewCoord.X := x;
   NewCoord.X := x;
   NewCoord.Y := y;
   NewCoord.Y := y;
   ClearLine(Y);
   ClearLine(Y);
@@ -384,7 +475,11 @@ begin
   try
   try
     cout(cMsg,cColor);
     cout(cMsg,cColor);
   finally
   finally
+    {$IFNDEF DELPHILINUX}
     SetCursorPos(LastCoord);
     SetCursorPos(LastCoord);
+    {$ELSE}
+    write(RESTORE_CURSOR_POS);
+    {$ENDIF}
   end;
   end;
 end;
 end;
 
 
@@ -436,7 +531,11 @@ begin
   TextAttr := (TextAttr and $F0) or (Color and $0F);
   TextAttr := (TextAttr and $F0) or (Color and $0F);
   if TextAttr <> LastMode then SetConsoleTextAttribute(hStdOut, TextAttr);
   if TextAttr <> LastMode then SetConsoleTextAttribute(hStdOut, TextAttr);
   {$ELSE}
   {$ELSE}
-  crt.TextColor(Color);
+    {$IFDEF DELPHILINUX}
+    write(AEC,';',Color,'m')
+    {$ELSE}
+    crt.TextColor(Color);
+    {$ENDIF}
   {$ENDIF}
   {$ENDIF}
 end;
 end;
 
 
@@ -453,7 +552,11 @@ begin
   TextAttr := (TextAttr and $0F) or ((Color shl 4) and $F0);
   TextAttr := (TextAttr and $0F) or ((Color shl 4) and $F0);
   if TextAttr <> LastMode then SetConsoleTextAttribute(hStdOut, TextAttr);
   if TextAttr <> LastMode then SetConsoleTextAttribute(hStdOut, TextAttr);
   {$ELSE}
   {$ELSE}
-  crt.TextBackground(Color);
+    {$IFDEF DELPHILINUX}
+    write(AEC,0,';',Color+10*10);
+    {$ELSE}
+    crt.TextBackground(Color);
+    {$ENDIF}
   {$ENDIF}
   {$ENDIF}
 end;
 end;
 
 
@@ -508,13 +611,21 @@ begin
 end;
 end;
 {$ELSE}
 {$ELSE}
 begin
 begin
+  {$IFDEF DELPHILINUX}
+  write(AEC,2,'J');
+  {$ELSE}
   ClrScr;
   ClrScr;
+  {$ENDIF}
 end;
 end;
 {$ENDIF}
 {$ENDIF}
 
 
 procedure ClearLine;
 procedure ClearLine;
 begin
 begin
+  {$IFNDEF DELPHILINUX}
   ClearLine(GetCursorY);
   ClearLine(GetCursorY);
+  {$ELSE}
+  write(AEC,'K');
+  {$ENDIF}
 end;
 end;
 
 
 procedure ClearLine(Y : Integer);
 procedure ClearLine(Y : Integer);
@@ -533,7 +644,11 @@ end;
 {$ELSE}
 {$ELSE}
 begin
 begin
   GotoXY(1,Y);
   GotoXY(1,Y);
+  {$IFDEF DELPHILINUX}
+  write(AEC,'K');
+  {$ELSE}
   DelLine;
   DelLine;
+  {$ENDIF}
   GotoXY(1,Y);
   GotoXY(1,Y);
 end;
 end;
 {$ENDIF}
 {$ENDIF}
@@ -755,7 +870,6 @@ procedure InitConsole;
 var
 var
   BufferInfo: TConsoleScreenBufferInfo;
   BufferInfo: TConsoleScreenBufferInfo;
 begin
 begin
-  Console.LogVerbose := LOG_ALL;
   Rewrite(Output);
   Rewrite(Output);
   hStdOut := TTextRec(Output).Handle;
   hStdOut := TTextRec(Output).Handle;
   {$IFDEF HASERROUTPUT}
   {$IFDEF HASERROUTPUT}
@@ -943,19 +1057,28 @@ end;
 
 
 initialization
 initialization
 
 
+Console.LogVerbose := LOG_ALL;
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 InitCriticalSection(CSConsole);
 InitCriticalSection(CSConsole);
 {$ELSE}
 {$ELSE}
-InitializeCriticalSection(CSConsole);
-//init stdout if not a service
-if GetStdHandle(STD_OUTPUT_HANDLE) <> 0 then InitConsole;
+  {$IFNDEF DELPHILINUX}
+  InitializeCriticalSection(CSConsole);
+  //init stdout if not a service
+  if GetStdHandle(STD_OUTPUT_HANDLE) <> 0 then InitConsole;
+  {$ELSE}
+  CSConsole := TRTLCriticalSection.Create;
+  {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
 finalization
 finalization
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 DoneCriticalsection(CSConsole);
 DoneCriticalsection(CSConsole);
 {$ELSE}
 {$ELSE}
-DeleteCriticalSection(CSConsole);
+  {$IFNDEF DELPHILINUX}
+  DeleteCriticalSection(CSConsole);
+  {$ELSE}
+  CSConsole.Free;
+  {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
 end.
 end.

+ 61 - 31
Quick.Files.pas

@@ -5,9 +5,9 @@
   Unit        : Quick.Files
   Unit        : Quick.Files
   Description : Files functions
   Description : Files functions
   Author      : Kike Pérez
   Author      : Kike Pérez
-  Version     : 1.4
+  Version     : 1.5
   Created     : 09/03/2018
   Created     : 09/03/2018
-  Modified    : 21/01/2019
+  Modified    : 16/02/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -45,6 +45,11 @@ uses
     baseunix,
     baseunix,
     {$ENDIF}
     {$ENDIF}
   {$ENDIF}
   {$ENDIF}
+  {$IFDEF POSIX}
+  Posix.Base,
+  Posix.SysStat,
+  Posix.Utime,
+  {$ENDIF}
   DateUtils;
   DateUtils;
 
 
 {$IFDEF FPC}
 {$IFDEF FPC}
@@ -87,7 +92,7 @@ type
         procedure Close;
         procedure Close;
         property EOF: Boolean read GetEOF;
         property EOF: Boolean read GetEOF;
     end;
     end;
-    {$IF Defined(MACOS) OR Defined(NEXTGEN)}
+    {$IF Defined(MACOS) OR Defined(NEXTGEN) OR Defined(DELPHILINUX)}
     TFileTime = LongInt;
     TFileTime = LongInt;
     {$ENDIF}
     {$ENDIF}
   {$ELSE}
   {$ELSE}
@@ -844,7 +849,7 @@ begin
     {$IFDEF FPC}
     {$IFDEF FPC}
     if not caseSensitive then UpperCase(SearchFor);
     if not caseSensitive then UpperCase(SearchFor);
     {$ELSE}
     {$ELSE}
-    if not caseSensitive then AnsiUpper(SearchFor);
+    if not caseSensitive then AnsiUpperCase(SearchFor);
     {$ENDIF}
     {$ENDIF}
     GetMem(pBuf, BufferSize);
     GetMem(pBuf, BufferSize);
     filesize := System.Filesize(F);
     filesize := System.Filesize(F);
@@ -863,7 +868,7 @@ begin
         {$IFDEF FPC}
         {$IFDEF FPC}
         if not caseSensitive then UpperCase(pScan);
         if not caseSensitive then UpperCase(pScan);
         {$ELSE}
         {$ELSE}
-        if not caseSensitive then AnsiUpper(pScan);
+        if not caseSensitive then AnsiUpperCase(pScan);
         {$ENDIF}
         {$ENDIF}
         pPos := StrPos(pScan, SearchFor);
         pPos := StrPos(pScan, SearchFor);
         if pPos <> nil then
         if pPos <> nil then
@@ -954,38 +959,64 @@ begin
   end;
   end;
 end;
 end;
 {$ELSE}
 {$ELSE}
-function GetLastAccessTime(const aFileName: string): TDateTime;
-var
-  info : stat;
-begin
-  Result := 0;
-  if fpstat(aFileName,info) <> 0 then
+  {$IFDEF FPC} //FPC Linux
+  function GetLastAccessTime(const aFileName: string): TDateTime;
+  var
+    info : stat;
   begin
   begin
-    Result := info.st_atime;
+    Result := 0;
+    if fpstat(aFileName,info) <> 0 then
+    begin
+      Result := info.st_atime;
+    end;
   end;
   end;
-end;
 
 
-function GetCreationTime(const aFilename : string): TDateTime;
-var
-  info : stat;
-begin
-  Result := 0;
-  if fpstat(aFileName,info) <> 0 then
+  function GetCreationTime(const aFilename : string): TDateTime;
+  var
+    info : stat;
   begin
   begin
-    Result := info.st_ctime;
+    Result := 0;
+    if fpstat(aFileName,info) <> 0 then
+    begin
+      Result := info.st_ctime;
+    end;
   end;
   end;
-end;
 
 
-function GetLastWriteTime(const aFileName : string): TDateTime;
-var
-  info : stat;
-begin
-  Result := 0;
-  if fpstat(aFileName,info) <> 0 then
+  function GetLastWriteTime(const aFileName : string): TDateTime;
+  var
+    info : stat;
+  begin
+    Result := 0;
+    if fpstat(aFileName,info) <> 0 then
+    begin
+      Result := info.st_mtime;
+    end;
+  end;
+  {$ELSE} //Delphi Nextgen & Linux
+  function GetLastAccessTime(const aFileName: string): TDateTime;
+  var
+    info : TDateTimeInfoRec;
   begin
   begin
-    Result := info.st_mtime;
+    if FileGetDateTimeInfo(aFileName,info,True) then Result := info.LastAccessTime
+      else Result := 0.0;
   end;
   end;
-end;
+
+  function GetCreationTime(const aFilename : string): TDateTime;
+   var
+    info : TDateTimeInfoRec;
+  begin
+    if FileGetDateTimeInfo(aFileName,info,True) then Result := info.CreationTime
+      else Result := 0.0;
+  end;
+
+  function GetLastWriteTime(const aFileName : string): TDateTime;
+   var
+    info : TDateTimeInfoRec;
+  begin
+    if FileGetDateTimeInfo(aFileName,info,True) then Result := info.TimeStamp
+      else Result := 0.0;
+  end;
+  {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
 {$IFDEF FPC}
 {$IFDEF FPC}
@@ -1038,8 +1069,7 @@ begin
 end;
 end;
 {$ENDIF}
 {$ENDIF}
 {$IFDEF POSIX}
 {$IFDEF POSIX}
-class function TDirectory.ConvertDateTimeToFileTime(const DateTime: TDateTime;
-  const UseLocalTimeZone: Boolean): time_t;
+function ConvertDateTimeToFileTime(const DateTime: TDateTime; const UseLocalTimeZone: Boolean): TFileTime;
 begin
 begin
   { Use the time zone if necessary }
   { Use the time zone if necessary }
   if not UseLocalTimeZone then
   if not UseLocalTimeZone then

+ 6 - 2
Quick.Log.pas

@@ -309,7 +309,11 @@ InitCriticalSection(CS);
   {$IF Defined(MACOS) OR Defined(ANDROID)}
   {$IF Defined(MACOS) OR Defined(ANDROID)}
   CS := TCriticalSection.Create;
   CS := TCriticalSection.Create;
   {$ELSE}
   {$ELSE}
-  InitializeCriticalSection(CS);
+    {$IFDEF DELPHILINUX}
+    CS := TRTLCriticalSection.Create;
+    {$ELSE}
+    InitializeCriticalSection(CS);
+    {$ENDIF}
   {$ENDIF}
   {$ENDIF}
 {$ENDIF}
 {$ENDIF}
 
 
@@ -317,7 +321,7 @@ finalization
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 {$IF DEFINED(FPC) AND DEFINED(LINUX)}
 DoneCriticalsection(CS);
 DoneCriticalsection(CS);
 {$ELSE}
 {$ELSE}
-  {$IF Defined(MACOS) OR Defined(ANDROID)}
+  {$IF Defined(MACOS) OR Defined(ANDROID) OR Defined(DELPHILINUX)}
   CS.Free;
   CS.Free;
   {$ELSE}
   {$ELSE}
   DeleteCriticalSection(CS);
   DeleteCriticalSection(CS);

+ 2 - 2
Quick.SyncObjs.Linux.Compatibility.pas

@@ -13,7 +13,7 @@ type
 
 
   procedure EnterCriticalSection(CS : TCriticalSection);
   procedure EnterCriticalSection(CS : TCriticalSection);
   procedure LeaveCriticalSection(CS : TCriticalSection);
   procedure LeaveCriticalSection(CS : TCriticalSection);
-  procedure InitializeCriticalSection(CS : TCriticalSection);
+  procedure InitializeCriticalSection(var CS : TCriticalSection);
   procedure DeleteCriticalSection(CS : TCriticalSection);
   procedure DeleteCriticalSection(CS : TCriticalSection);
 
 
 implementation
 implementation
@@ -28,7 +28,7 @@ begin
   CS.Leave;
   CS.Leave;
 end;
 end;
 
 
-procedure InitializeCriticalSection(CS : TCriticalSection);
+procedure InitializeCriticalSection(var CS : TCriticalSection);
 begin
 begin
   CS := TCriticalSection.Create;
   CS := TCriticalSection.Create;
 end;
 end;

+ 6 - 0
Quick.SysInfo.pas

@@ -29,6 +29,8 @@
 
 
 unit Quick.SysInfo;
 unit Quick.SysInfo;
 
 
+{$i QuickLib.inc}
+
 interface
 interface
 
 
 {$IFDEF FPC}
 {$IFDEF FPC}
@@ -98,7 +100,11 @@ begin
   {$ELSE}
   {$ELSE}
   fAppPath := TPath.GetDocumentsPath;
   fAppPath := TPath.GetDocumentsPath;
   {$ENDIf}
   {$ENDIf}
+  {$IFDEF DELPHILINUX}
+  fUserName := GetLoggedUserName;
+  {$ELSE}
   fUserName := Trim(GetLoggedUserName);
   fUserName := Trim(GetLoggedUserName);
+  {$ENDIF}
   fHostName := GetComputerName;
   fHostName := GetComputerName;
   fOSVersion := GetOSVersion;
   fOSVersion := GetOSVersion;
   fCPUCores := CPUCount;
   fCPUCores := CPUCount;

+ 3 - 1
Quick.Threads.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Author      : Kike Pérez
   Version     : 1.4
   Version     : 1.4
   Created     : 09/03/2018
   Created     : 09/03/2018
-  Modified    : 24/01/2019
+  Modified    : 18/02/2019
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -1479,7 +1479,9 @@ end;
 constructor TScheduledWorker.Create(aNumWorker : Integer; aScheduledTask: IScheduledTask);
 constructor TScheduledWorker.Create(aNumWorker : Integer; aScheduledTask: IScheduledTask);
 begin
 begin
   inherited Create(aNumWorker,nil);
   inherited Create(aNumWorker,nil);
+  {$IFNDEF DELPHILINUX}
   NameThreadForDebugging(aScheduledTask.Name,aScheduledTask.IdTask);
   NameThreadForDebugging(aScheduledTask.Name,aScheduledTask.IdTask);
+  {$ENDIF}
   FreeOnTerminate := True;
   FreeOnTerminate := True;
   fCurrentTask := aScheduledTask;
   fCurrentTask := aScheduledTask;
 end;
 end;