Commit 703289d1 authored by rswindell's avatar rswindell
Browse files

Move expected location of jsexec.ini from exec directory to ctrl directory:

- argv[0] does not always contain the full path to the executable, so that is
  not a good way to locate the exec directory.
- since we already need to know the ctrl dir and that is the normal place to
  put config files, that's where it shall be.
- jsdoor builds don't get a .ini file - I don't think they need it (?)
parent f4798cde
......@@ -1195,15 +1195,17 @@ int main(int argc, char **argv, char** env)
if(!winsock_startup())
return(do_bail(2));
SAFECOPY(ini_fname, argv[0]);
if((p = getfext(ini_fname)) != NULL)
*p = 0;
SAFECAT(ini_fname, ".ini");
#ifndef JSDOOR
SAFECOPY(scfg.ctrl_dir, get_ctrl_dir());
iniFileName(ini_fname, sizeof(ini_fname), scfg.ctrl_dir, "jsexec.ini");
if((fp = iniOpenFile(ini_fname, /* create: */FALSE)) != NULL) {
ini = iniReadFile(fp);
iniCloseFile(fp);
} else {
fprintf(stderr, "Error %d (%s) opening %s\n", errno, strerror(errno), ini_fname);
}
get_ini_values(ini, /* section (global): */NULL, &cb);
#endif
getcwd(orig_cwd, sizeof(orig_cwd));
backslash(orig_cwd);
......@@ -1362,12 +1364,6 @@ int main(int argc, char **argv, char** env)
get_ini_values(ini, ini_section, &cb);
}
#ifndef JSDOOR
if(scfg.ctrl_dir[0]==0) {
SAFECOPY(scfg.ctrl_dir, get_ctrl_dir());
}
#endif
if(umask_val >= 0)
umask(umask_val);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment