Best Practice for Config files

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
zillmer
Posts: 14
Joined: Wed Jan 03, 2018 4:57 pm

Best Practice for Config files

Post by zillmer »

Hi,

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.

Thanks

Simon.
dsdawson
Posts: 36
Joined: Sat Jan 14, 2012 5:46 pm

Re: Best Practice for Config files

Post by dsdawson »

Use SHGetKnownFolderPath or SHGetFolderPath to retrieve either the Program Data or the AppData folders.
That's what those folders are for.

Doug
Post Reply