[Gambas-user] Help with a Gambas version of VB registry settings functions?

chrisken chrisken0 at ...626...
Sun Apr 11 16:25:23 CEST 2010


Hi, everybody. I've been thinking for a while that I'd like to come up with a
gambas equivalent for the useful 'registry settings' functions included in
visual basic 6 - obviously they couldn't use the registry in the same way,
since that doesn't really exist in Linux, but the need for a simple way of
saving and reloading the last known state of my programs and other simple
details is something that does carry over. The most important routines to
me, are:

SaveSetting (appname, section, key, value) - saves the given value, filed by
appname, section, and key
GetSetting (appname, section, key, optional defaultvalue) - returns the
previous value saved for the given appname, section, and key. If no previous
value is found, returns defaultvalue if it is supplied, or else an empty
string.

GetAllSettings (which returns a two-dimensional array of all keys and values
for a given appname and section) and DeleteSetting (which clears out the
previous value for an appname/section/key) would be useful too, but not
critical.

So - any suggestions for how best to handle this? I've been wondering about
the storage medium - if I can actually dynamically write .ini type files, or
if it would be easier to handle this in a sqlite database format. Also, I'm
not sure about where to put the files so that they'd be found no matter what
gambas program is accessing them, (is there a way to find out what the
user's home directory path is called?) and if I go with sqlite, I'd need a
way to test to see if my table is already in the sqlite file or not.

Sorry for the rambling-ness. Any replies would be appreciated.
-- 
View this message in context: http://old.nabble.com/Help-with-a-Gambas-version-of-VB-registry-settings-functions--tp28208990p28208990.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list