Recent

Author Topic: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS  (Read 1101 times)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1509
  • Former Delphi 1-7, 10.2 user
Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« on: March 28, 2021, 06:39:18 am »
As a result of the odd decision by the FPC developers to stop treating UNIX directories as files -- unless its the renamefile() function -- the following Lazarus code in lazarus-src/lcl/include/sysenvapis_mac.inc is broken:

Code: Pascal  [Select][+][-]
  1. // Open a document with the default application associated with it in the system
  2. function OpenDocument(APath: String): Boolean;
  3. var
  4.   ResultingPath: string;
  5.   lpath: string;
  6. begin
  7.   Result := True;
  8.   if not FileExistsUTF8(APath) then begin
  9.     // Windows OpenDocument handles URLs as well
  10.     Result := OpenURL(Apath);
  11.     Exit;
  12.   end;
  13.   // Paths with spaces need to be quoted, see bug 21651
  14.   if (APath<>'') and (APath[1]<>'''') then
  15.     ResultingPath:=QuotedStr(APath)
  16.   else
  17.     ResultingPath:=APath;
  18.   RunCmdFromPath('open',ResultingPath);

The highlighted line now needs to be changed to:

Code: Pascal  [Select][+][-]
  1. if not FileExistsUTF8(APath) and not DirectoryExistsUTF8(aPath) then begin

I lost many hours yesterday trying to work out why my carefully constructed Apple Help Book, a fragile construction at the best of times given Apple's outdated and now often incorrect documentation which petered out in 2013, did not work. For once, it wasn't my code and it wasn't my finely crafted property lists at fault.

Logged: https://bugs.freepascal.org/view.php?id=38670
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5 aarch64 Xcode 12.5.1
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

Bart

  • Hero Member
  • *****
  • Posts: 4351
    • Bart en Mariska's Webstek
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #1 on: March 28, 2021, 02:45:21 pm »
Please file a bugreport.

Bart

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1509
  • Former Delphi 1-7, 10.2 user
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #2 on: March 29, 2021, 11:15:39 am »
I did - see last line of my post :)
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5 aarch64 Xcode 12.5.1
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

Bart

  • Hero Member
  • *****
  • Posts: 4351
    • Bart en Mariska's Webstek
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #3 on: March 29, 2021, 11:28:17 am »
Thank you, I missed that.

Could you upload a patch (in the bugtracker) against trunk please.
See my comments in the bugreport.
I don't have access to a Mac, so I cannot even check if it compiles if I make the changes myself.
I'll apply it then.

Bart

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1509
  • Former Delphi 1-7, 10.2 user
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #4 on: March 29, 2021, 12:31:17 pm »
Working on it... done and thanks!
« Last Edit: March 29, 2021, 12:54:26 pm by trev »
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5 aarch64 Xcode 12.5.1
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

Bart

  • Hero Member
  • *****
  • Posts: 4351
    • Bart en Mariska's Webstek
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #5 on: March 29, 2021, 05:48:34 pm »
Applied in r64890.
Please test and close the bugreport if OK.

Bart

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1509
  • Former Delphi 1-7, 10.2 user
Re: Lazarus OpenDocument broken with FPC 3.2.0 + trunk for macOS
« Reply #6 on: March 30, 2021, 01:54:01 am »
Done and tested. Harmony has now been restored to the macOS universe in Lazarus trunk. Thanks!
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5 aarch64 Xcode 12.5.1
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

 

TinyPortal © 2005-2018