Recent

Author Topic: Application settings and cache files  (Read 718 times)

Igor Kokarev

  • Full Member
  • ***
  • Posts: 225
Application settings and cache files
« on: April 01, 2020, 04:31:22 pm »
Hi,

Please advice - where to store application settings (.ini files) and cache files to comply Apple's requirements?

in APP bundle, or another location?

If store in APP bundle, will it possible to import settings from old version?

If store settings in some system folder (like AppData in Windows) how to correctly remove them when user uninstalls an app?

jwdietrich

  • Hero Member
  • *****
  • Posts: 1138
    • formatio reticularis
Re: Application settings and cache files
« Reply #1 on: April 01, 2020, 05:01:05 pm »
No, you shouldn't save settings in the app's bundle.

macOS has several preferences folders, depending on the domain to use (global, local or user). You may find an example for a platform-sensitive method to find the correct folder at https://wiki.lazarus.freepascal.org/Locating_macOS_app_support,_preferences_folders. This code works on any platform.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.10 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

Igor Kokarev

  • Full Member
  • ***
  • Posts: 225
Re: Application settings and cache files
« Reply #2 on: April 01, 2020, 07:23:44 pm »
Thanks for your reply and the link!

 

TinyPortal © 2005-2018