Best Practice for Config files

zillmer
Posts: 5
Joined: Wed Jan 03, 2018 4:57 pm

Best Practice for Config files

Postby zillmer » Wed May 22, 2019 8:20 am

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

Postby dsdawson » Wed May 22, 2019 11:49 am

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

Doug


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 10 guests