using config file instead of registry
Posted: Mon Jul 03, 2006 2:38 am
Using the registry makes it difficult to run your application as a normal user (I also don't see a big reason the info should be hidden), would you mind moving a configuration file instead (an ini specifically)?
If so I wrote a very light wrapper around TIniFile I called TIMOMConfig you could use that has the following:
function GetInt(settingName : string) : Integer;
function GetStr(settingName : string) : string;
procedure SetInt(settingName : string; setting : Integer);
procedure SetStr(settingName : string; setting : string);
function GetLBXPath : string;
function GetMusicPath : string;
function GetTexturePath : string;
function GetServerDBPath : string;
function GetLanguageFilePath : string;
function GetClientGraphicsDBFilename : string;
function GetLanguage : string;
I also overloaded Create so that you can specify a config file or not (if not then ".\config.ini" is used); if the config file is not found it is created and if config_file_path is set then the value is used as the config file so things like %homepath% are easily accomidated.
If you are interested and want to use what I wrote instead of using straight TIniFile then I'll post the file.
edit:
I'll be gone from the 4th through the 11th so when I don't reply it's not because I died or lost interest.
If so I wrote a very light wrapper around TIniFile I called TIMOMConfig you could use that has the following:
function GetInt(settingName : string) : Integer;
function GetStr(settingName : string) : string;
procedure SetInt(settingName : string; setting : Integer);
procedure SetStr(settingName : string; setting : string);
function GetLBXPath : string;
function GetMusicPath : string;
function GetTexturePath : string;
function GetServerDBPath : string;
function GetLanguageFilePath : string;
function GetClientGraphicsDBFilename : string;
function GetLanguage : string;
I also overloaded Create so that you can specify a config file or not (if not then ".\config.ini" is used); if the config file is not found it is created and if config_file_path is set then the value is used as the config file so things like %homepath% are easily accomidated.
If you are interested and want to use what I wrote instead of using straight TIniFile then I'll post the file.
edit:
I'll be gone from the 4th through the 11th so when I don't reply it's not because I died or lost interest.