mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-30 16:50:45 +00:00
fix for relative paths in -config argument
This commit is contained in:
parent
d5ef2a2a11
commit
64d8dcd3a3
31
src/config.c
31
src/config.c
@ -1039,20 +1039,29 @@ config_parse_config_gsplus_file()
|
|||||||
g_highest_smartport_unit = -1;
|
g_highest_smartport_unit = -1;
|
||||||
|
|
||||||
cfg_get_base_path(&g_cfg_cwd_str[0], g_config_gsplus_name, 0);
|
cfg_get_base_path(&g_cfg_cwd_str[0], g_config_gsplus_name, 0);
|
||||||
#ifndef __OS2__
|
|
||||||
if(g_cfg_cwd_str[0] != 0) {
|
// I think this code is wrong. It breaks relative config paths on the "-config"
|
||||||
ret = chdir(&g_cfg_cwd_str[0]);
|
// option. ie "./gsplus -config foo/bar.gsp"
|
||||||
if(ret != 0) {
|
// It's possible it was needed for some of the autodiscovery stuff, but I'm
|
||||||
printf("chdir to %s, errno:%d\n", g_cfg_cwd_str, errno);
|
// not really a fan of that either and think it should be take out.
|
||||||
}
|
// Especially now that you can pass a filename.
|
||||||
}
|
|
||||||
/* In any case, copy the directory path to g_cfg_cwd_str */
|
// #ifndef __OS2__
|
||||||
(void)getcwd(&g_cfg_cwd_str[0], CFG_PATH_MAX);
|
// if(g_cfg_cwd_str[0] != 0) {
|
||||||
#endif
|
// ret = chdir(&g_cfg_cwd_str[0]);
|
||||||
|
// if(ret != 0) {
|
||||||
|
// printf("chdir to %s, errno:%d\n", g_cfg_cwd_str, errno);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// /* In any case, copy the directory path to g_cfg_cwd_str */
|
||||||
|
// (void)getcwd(&g_cfg_cwd_str[0], CFG_PATH_MAX);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
fconf = fopen(g_config_gsplus_name, "r");
|
fconf = fopen(g_config_gsplus_name, "r");
|
||||||
if(fconf == 0) {
|
if(fconf == 0) {
|
||||||
fatal_printf("cannot open configuration file at %s! Stopping!\n",
|
perror("ERROR");
|
||||||
|
fatal_printf("Cannot open configuration file at %s! Stopping!\n",
|
||||||
g_config_gsplus_name);
|
g_config_gsplus_name);
|
||||||
my_exit(3);
|
my_exit(3);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user