* * *

Author Topic: [solved]Application Bundle  (Read 395 times)

dbannon

  • Jr. Member
  • **
  • Posts: 62
[solved]Application Bundle
« on: October 12, 2017, 02:15:18 am »
I am having a great deal of problems working with a Mac. Its Unix Captain, but not as we know it....

I understand the Mac wants an app directory like MyApp/Contents/MacOS/TheBinary. And, I guess, its kind of tidy.  But Lazarus makes a bundle with a link were the binary should be back up to same level as as the app directory -

TheBinary
MyApp.app/Contents/MacOS/(Link../../../TheBinary)

If I move the binary down to MacOS and overwrite the link, it will run from command line but not from the GUI. I get told "The application cannot be opened". Put another copy of the binary back, level with the MyApp.app and it works again.

If I want to distribute this, I'd prefer to send it out as a single directory, thats how it should be IMHO ? Can I ?

David


« Last Edit: October 12, 2017, 12:21:58 pm by dbannon »
Lazarus 1.8rc4, Linux (and Win10, OSX)

Phil

  • Hero Member
  • *****
  • Posts: 2302
Re: Apploication Bundle
« Reply #1 on: October 12, 2017, 04:18:19 am »
But Lazarus makes a bundle with a link were the binary should be back up to same level as as the app directory -

That's a known defect in Lazarus, that it can't create a proper app bundle.

Copying the actual executable over the symlink is all you normally need to do to fix this.

You can also install the ExportToXcode package in Lazarus and export to Xcode, where you can compile your Lazarus project and create a proper app bundle, edit the Info.plist file, etc.

For future projects, you can install the LazXProj package and create a proper app bundle that way.

For both, see this:

https://macpgmr.github.io/

dbannon

  • Jr. Member
  • **
  • Posts: 62
Re: Apploication Bundle
« Reply #2 on: October 12, 2017, 07:46:57 am »
Thanks Phil. I did try copying the executable over the symlink but, as I said, if I remove the the original executable, the app cannot be started from the GUI.  Works fine from the command line but the GUI seems to need the binary up level with the app directory.

I'll look at the link you posted.

Thanks
Lazarus 1.8rc4, Linux (and Win10, OSX)

mischi

  • Jr. Member
  • **
  • Posts: 74
Re: Application Bundle
« Reply #3 on: October 12, 2017, 09:09:15 am »
I did try copying the executable over the symlink but, as I said, if I remove the the original executable, the app cannot be started from the GUI.  Works fine from the command line but the GUI seems to need the binary up level with the app directory.
If I replace the symlink with the actual binary, the program can be started by a double click on the icon of the application bundle. If this does not work in your case, there is still something wrong. Maybe the name of the binary does not match the name in the file Info.plist or a field is missing in the Info.plist file. Code signing could also be an issue, although I am not sure about the situation with El Capitan.

dbannon

  • Jr. Member
  • **
  • Posts: 62
Re: Application Bundle
« Reply #4 on: October 12, 2017, 12:21:29 pm »
yes, thanks Phil, mischi.

You are right, it works fine. I was copying the binary down into the app directory and did not notice I got an error message. OSX was telling me the link was identical to the binary and refusing to copy. So, delete the link, copy and it all worked as expected.

Careless, sorry to bother you guys.

David
Lazarus 1.8rc4, Linux (and Win10, OSX)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus