// read config file, e.g. cc_config.xml // Called on startup and in response to GUI RPC requesting reread // int read_config_file(bool init, const char* fname) { if (!init) { msg_printf(NULL, MSG_INFO, "Re-reading %s", fname); cc_config.defaults(); log_flags.init(); } FILE* f = boinc_fopen(fname, "r"); if (!f) { msg_printf(NULL, MSG_INFO, "cc_config.xml not found - using defaults"); return ERR_FOPEN; } cc_config.parse_client(f); fclose(f); #ifndef SIM diagnostics_set_max_file_sizes( cc_config.max_stdout_file_size, cc_config.max_stderr_file_size ); #endif config_proxy_info = cc_config.proxy_info; if (init) { coprocs = cc_config.config_coprocs; } else { select_proxy_info(); // in case added or removed proxy info } return 0; }
int read_config_file(bool init, const char* fname) { if (!init) { msg_printf(NULL, MSG_INFO, "Re-reading %s", fname); config.defaults(); log_flags.init(); } FILE* f = boinc_fopen(fname, "r"); if (!f) { msg_printf(NULL, MSG_INFO, "No config file found - using defaults"); return ERR_FOPEN; } config.parse_client(f); fclose(f); #ifndef SIM diagnostics_set_max_file_sizes( config.max_stdout_file_size, config.max_stderr_file_size ); #endif if (init) { coprocs = config.config_coprocs; config_proxy_info = config.proxy_info; if (strlen(config.data_dir)) { #ifdef _WIN32 _chdir(config.data_dir); #else chdir(config.data_dir); #endif } } return 0; }