Application Config Files

I am in the process of converting my .NET libraries to xojo. In .NET it has an app.config file that lets you store settings the application uses. What is the xojo equivalent of this? Or what is the best practice to read items from a text file that control the program behavior? Preferably something that resides in the application folder and does not disappear when you debug.

Putting files next to the EXE itself can be problematic on pretty much all OSes
It often requires privileges to create and edit - something not all users have

A “best practice” would be to use a custom directory for your app that you create in the Application Support dir
Then on initial launch of the app you check to see if your folder and file exist and if not then create them and set them up with default values
When editing “preferences” for your app you alter the values in that file

That would be my recommendation

you could add a ressource file as template and at runtime use a file in sub folder at app data.

Thank you for the fast replies. My use case for this is not to have them user modifiable. This is for administration only, mostly for console apps with things like source and destination folders, etc. This would allow the application to be moved, folder location moved and the application would not need recompilation.

I like the project you sent Markus and will use this approach.

The App.Config file stores what is essentially a bunch of constants in an external file which is an XML file with the name of the executable file + .config. The contents of this file are “constants” as they can not be changed by the application itself, but can be edited externally and are read when the app starts. As such there is no reason why they can’t be stored next to the application.

@Richard Kinning if you are interested I have an application that writes these config files, adds a module to your Xojo Text project and add’s a post build script to copy the config file when running or debugging. PM me if you’d like to test the app.