Recent

Author Topic: Custom files in Mac?  (Read 828 times)

Espectr0

  • Full Member
  • ***
  • Posts: 218
Custom files in Mac?
« on: May 30, 2022, 06:12:52 pm »
Hola,
a little query, if my application uses external files such as for the language, in the "myapp/langs/en.xml" path, can I add these files in the macOS .app? 
or do I have to make an installer and copy them to the preferences folder?

Thanks

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Custom files in Mac?
« Reply #1 on: May 30, 2022, 08:33:37 pm »
Your application is distributed as a bundle:
https://wiki.freepascal.org/Application_Bundle

The bundle contains both your executable and your data (including translation files).
You should put all the translation files into the bundle.


Espectr0

  • Full Member
  • ***
  • Posts: 218
Re: Custom files in Mac?
« Reply #2 on: June 04, 2022, 03:37:21 pm »
thanks @skalogryz,

But where do I indicate the .lng files that I want to add, etc?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Custom files in Mac?
« Reply #3 on: June 05, 2022, 07:22:43 am »
there's no place to specify those files at the moment.
Meaning, Lazarus IDE would not copy those files for you into the bundle.

IDE would create the .app bundle for you. (with the basic directory structure). You'd need to copy over the files yourself.

The fact, is you don't have to physically copy them while you're DEVELOPING. Instead you could create symbolic links (in the bundle) for those files. IDE does this "symbolic link" trick for the executable itself.

When you're DISTRIBUTING the bundle to your application users you need to make sure that files are actually copied into the bundle. (which also applies to the executable itself).

If you're not familiar with "symbolic link" concept, or don't know how to use them, you can simply copy the files over in the bundle.
Again, there's no built-in features in IDE to do that (yet?).
But you could use "post-build" scripting in order to copy the files in automated manner.

OR if the additional files  (.ing, etc) , don't change too often you can simply copy them one-time and keep developing.


 

TinyPortal © 2005-2018