Page 1 of 1

Best Practice for Config files

Posted: Wed May 22, 2019 8:20 am
by zillmer

I am developing a PDK application that needs to have some user-configurable parameters. The application will be installed using the add-on.xml method as described in the SDK.

I am intending to use a text file (either in .ini or xml format) to store and retrieve some user configurable parameters at run time.

Is there a best practice on where to store this file?

The SDK does reference having a Data folder, but I can’t see how to obtain a reference to the path to that folder?

If I obtain from windows the path to the application directory within my PDK code I get the path to the Prepar3d.exe. I could hard code assuming that the add-on will be installed in user/documents/Prepar3dv4 Add-Ons/Addonname, but this is not very elegant and requires the user to install the add-on with a specific folder name.



Re: Best Practice for Config files

Posted: Wed May 22, 2019 11:49 am
by dsdawson
Use SHGetKnownFolderPath or SHGetFolderPath to retrieve either the Program Data or the AppData folders.
That's what those folders are for.