Recent

Author Topic: Distribute application with database  (Read 3524 times)

acolburn

  • New Member
  • *
  • Posts: 14
Distribute application with database
« on: January 14, 2016, 07:10:20 am »
Forgive my ignorance; I am totally new to all of this ... I wrote a small app on Windows 10, copied all the files to a Mac, opened and ran the app in OS X (Yosemite). Everything is working pretty much OK from within the IDE. The app uses a simple SQLite3 database which lives in the same folder as the executable.

My question is how do I turn this into a distributable Mac app? Info I found leads me to think it's just Project->Project Options->Application->Create App Bundle, but double clicking the resulting Application folder gives me an error about how the SQLite3Connection component can't connect to the database file.

I tried moving the db file to various places within the Application folder, but that doesn't make a difference. So what am I supposed to be doing?

Thanks!

p.s. FPC version 3.1.1.

balazsszekely

  • Guest
Re: Distribute application with database
« Reply #1 on: January 14, 2016, 07:33:34 am »
After you finish developing the application:
1. Backup your project folder
2. Copy the executable(YourApp) and the database(YourDB) inside the bundle: "YourApp.app/Contents/MacOS/" and replace YourApp(link) wich is actually a symlink and points to the project folder's executable.
Use the following path for database: DbPath := ParamStr(0) + 'YourDB'. It will give you the correct result no matter if your project is under development(executable and db in project folder) or it's released version(executable and db inside the bundle).
 

acolburn

  • New Member
  • *
  • Posts: 14
Re: Distribute application with database
« Reply #2 on: January 14, 2016, 06:40:11 pm »
Thanks, GetMem. I really appreciate you taking the time to respond. ... I think I'm still missing something. I opened my application file (right click, Show Package Contents) and navigated to the /Contents/MacOS folder. Into this I copied  the executable (file whose icon is black square with 'exec' in green text) and my db file. Regardless of whether I'd changed the DatabasePath string or not, I'm still getting the same error message if I double click on the resulting application file (which, in my case, looks like it's just the application name ... no .app suffix, etc.).

It's humbling to be such a newbie!

thanks again,
al

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Distribute application with database
« Reply #3 on: January 14, 2016, 10:13:34 pm »
you should dbl click on your YourBundle.app icon, not onto application inside YourBundle.app/Contents/MacOS

 

TinyPortal © 2005-2018