Change Config::PrintConfig to use std::string
This commit is contained in:
parent
5a41709a47
commit
f243f585ed
4 changed files with 12 additions and 12 deletions
|
@ -73,7 +73,7 @@ public:
|
|||
void Init();
|
||||
void ShutDown();
|
||||
void StartUp();
|
||||
bool PrintConfig(char const * const configfilename) const;
|
||||
bool PrintConfig(const std::string &filename) const;
|
||||
bool ParseConfigFile(char const * const configfilename);
|
||||
void ParseEnv(char ** envp);
|
||||
bool SecureMode() const { return secure_mode; }
|
||||
|
|
|
@ -2585,8 +2585,8 @@ static void launcheditor() {
|
|||
Cross::GetPlatformConfigName(file);
|
||||
path += file;
|
||||
FILE* f = fopen(path.c_str(),"r");
|
||||
if(!f && !control->PrintConfig(path.c_str())) {
|
||||
printf("tried creating %s. but failed.\n",path.c_str());
|
||||
if (!f && !control->PrintConfig(path)) {
|
||||
printf("tried creating %s. but failed.\n", path.c_str());
|
||||
exit(1);
|
||||
}
|
||||
if(f) fclose(f);
|
||||
|
@ -2675,8 +2675,8 @@ static void printconfiglocation() {
|
|||
path += file;
|
||||
|
||||
FILE* f = fopen(path.c_str(),"r");
|
||||
if(!f && !control->PrintConfig(path.c_str())) {
|
||||
printf("tried creating %s. but failed",path.c_str());
|
||||
if (!f && !control->PrintConfig(path)) {
|
||||
printf("tried creating %s. but failed", path.c_str());
|
||||
exit(1);
|
||||
}
|
||||
if(f) fclose(f);
|
||||
|
@ -2829,7 +2829,7 @@ int main(int argc, char* argv[]) {
|
|||
Cross::CreatePlatformConfigDir(config_path);
|
||||
Cross::GetPlatformConfigName(config_file);
|
||||
config_combined = config_path + config_file;
|
||||
if (control->PrintConfig(config_combined.c_str())) {
|
||||
if (control->PrintConfig(config_combined)) {
|
||||
LOG_MSG("CONFIG: Generating default configuration.\n"
|
||||
"CONFIG: Writing it to %s",
|
||||
config_combined.c_str());
|
||||
|
@ -2864,7 +2864,7 @@ int main(int argc, char* argv[]) {
|
|||
Cross::CreatePlatformConfigDir(config_path);
|
||||
Cross::GetPlatformConfigName(config_file);
|
||||
config_combined = config_path + config_file;
|
||||
if (control->PrintConfig(config_combined.c_str())) {
|
||||
if (control->PrintConfig(config_combined)) {
|
||||
LOG_MSG("CONFIG: Generating default configuration.\n"
|
||||
"CONFIG: Writing it to %s",
|
||||
config_combined.c_str());
|
||||
|
|
|
@ -297,8 +297,8 @@ private:
|
|||
name = config_path + name;
|
||||
}
|
||||
WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_WHICH"),name.c_str());
|
||||
if (!control->PrintConfig(name.c_str())) {
|
||||
WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),name.c_str());
|
||||
if (!control->PrintConfig(name)) {
|
||||
WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"), name.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -719,10 +719,11 @@ string Section_line::GetPropValue(string const& /* _property*/) const {
|
|||
return NO_SUCH_PROPERTY;
|
||||
}
|
||||
|
||||
bool Config::PrintConfig(char const * const configfilename) const {
|
||||
bool Config::PrintConfig(const std::string &filename) const
|
||||
{
|
||||
char temp[50];
|
||||
char helpline[256];
|
||||
FILE* outfile = fopen(configfilename,"w+t");
|
||||
FILE *outfile = fopen(filename.c_str(), "w+t");
|
||||
if (outfile == NULL) return false;
|
||||
|
||||
/* Print start of configfile and add a return to improve readibility. */
|
||||
|
@ -801,7 +802,6 @@ bool Config::PrintConfig(char const * const configfilename) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
Section_prop* Config::AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange) {
|
||||
Section_prop* blah = new Section_prop(_name);
|
||||
blah->AddInitFunction(_initfunction,canchange);
|
||||
|
|
Loading…
Add table
Reference in a new issue