Saving User Settings

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Saving User Settings

Post by chadman » Mon Mar 28, 2005 2:10 am

Where should I save user settings for my program? I definitely don't want to use the Windows registry becuase I want it to work on Linux. Should I use an XML file, or something else?

And in what folder should settings be saved? For Windows I was thinking %USERPROFILE%\Application Data\program_name.

User avatar
T-Rex
Moderator
Moderator
Posts: 1195
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Mon Mar 28, 2005 5:17 am

You can use wxFileConfig (It creates INI-files)

chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Post by chadman » Mon Mar 28, 2005 5:19 am

Is that better than XML in your opinion? I assume it also works on Linux?

mjs
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 09, 2005 3:53 am
Contact:

Post by mjs » Mon Mar 28, 2005 11:27 am

IMHO, wxFileConfig (INI) ...

1. isn't better than XML because it lack support for different charsets
2. lacks support of a generic way for element attributes
3. works on all platforms

BTW: When specifying a local/global file name you should use the static functions wxFileConfig::GetLocalFileName(const wxString &sFileName) and wxFileConfig::GetGlobalFileName(const wxString &sFileName) to get a full path to the configuration files. Take a look at the header files for a description of this functions.

Regards,
Mark

chadman
Experienced Solver
Experienced Solver
Posts: 70
Joined: Wed Mar 23, 2005 8:28 am

Post by chadman » Mon Mar 28, 2005 3:34 pm

Well thank I want to thank both of you for your input.

If I decide to use an XML file, what wx class is that?

mjs
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 09, 2005 3:53 am
Contact:

Post by mjs » Tue Mar 29, 2005 4:06 am

You have to develop it yourself. I was too lazy for this and therefore I always used wxFileConfig :oops: . The problem is that the xml api is - regarding to the documentation - still in development ...

Regards,
Mark

Post Reply