Path differences between development and runtime environments

Good Day Everybody,

I understand that the path an application runs in differs for development (application started from xojo) and “production” (application started from the directory it has been installed into).
Can you give me a hint and/or point me to documentation where this is explained in detail?
I try to create some files and save them in the application’s running directory but can’t get it to work because the directories are different for the two cases (“dev” and “prod”.

I remember something about “copy steps” too, but not sure if that will help me.

I hope that the above is understandable at least …

Thanks in advance for any input.

Thom

[Desktop apps — Xojo documentation]

There are also threads in this forum about the subject: https://forum.xojo.com/t/application-config-files/52865

What is your platform (Mac, Win)?

Please describe with more detail what you try to do. You shouldn’t save anything next to the application on macOS because of security. If you app needs helper files put those into the app itself and write the files to Application Support when the app starts.

1 Like

This folder (directory under Windows) is called “Applications”.

There was reasons why Apple (and Microsoft, others) have done that and you are pointing to them.

To avoid this kind of troubles, you have:
SpecialFolder

Look at FolderItem for CopyTo:

it will allow you to place folders (with data) where you need them to be (Documents or Application Support folders).

Place your code in the App.Open Event and check for the presence of this/these folder(s) before making the copy (so the CopyTo will be done only once.

Create one or two App Properties to Reference the master data folder (in Application Support) and user data folder (in Documents) for use when needed in the project…

As you now know, the Documentation is your best friend.

First of all thanks to all of you.
Every post had good and new information for me.
I will go on from there.

To add some background to it:
The OS is win11 and xojo is 2021r3 which is the release I bought a license for.

My application is for single user and saves its data in a SQLite DB which is created on first start of the application if it does ot exist already.
I want the user to be able to decide where the save the DB (this give the possibility to save the DB on a shared drive / one drive / … and makes the user machine independent from a data point of view).

To make the application remember the DB location I am planning to use either a text file or a “config db” saved to “ApplicationData”.

If you have better ideas … please tell me!

https://www.sqlite.org/draft/useovernet.html

Please read the above before making a decision on sqlite over shared drives

Save a SQLite DB with preferences in the ‘Application Data’ folder.
There you can store where the user decided to put the SQLite DB that contains the payload.

Hello Brian,
thanks for the hint. I am aware of possible issues.
I updated my post now accordingly.
The application is “single user”. The shared drive thing is for having the user data available even if using a different PC.

1 Like

yeah, thought that. It is much easier to handle a DB than e text file.
Thanks for confirming my doubts :smiley: