diff --git a/docs/notework.txt b/docs/notework.txt index c41de26..b5e75ca 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,9 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +! New locations of config file for unix-like OS: ~/.golded/, ~/ and + /usr/local/etc/. + + Compile-time defines to specify config file name: GEDCFG (default is "golded.cfg") and GEDCFG2 (default is platform-depended: "gedw32.cfg", "ged2.cfg", "geddos.cfg" or nothing). diff --git a/golded3/gefn.h b/golded3/gefn.h index 9ac0d79..81b8dc9 100644 --- a/golded3/gefn.h +++ b/golded3/gefn.h @@ -96,4 +96,22 @@ #define FIDOLASTREAD "lastread" #endif +#ifndef CFGUSERPATH1 +#ifdef __UNIX__ +#define CFGUSERPATH1 "~/.golded/" +#endif +#endif + +#ifndef CFGUSERPATH2 +#ifdef __UNIX__ +#define CFGUSERPATH2 "~/" +#endif +#endif + +#ifndef CFGPATH +#ifdef __UNIX__ +#define CFGPATH "/usr/local/etc/" +#endif +#endif + #endif /* __GEFN_H__ */ diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 351f064..e242bef 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -624,6 +624,31 @@ void Initialize(int argc, char* argv[]) { found = FindCfg(cmdlinecfg); } + #ifdef CFGUSERPATH1 + // Get it in user directory (step 1) + if(not found) { + strxcpy(cmdlinecfg, CFGUSERPATH1, sizeof(cmdlinecfg)); + getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + found = FindCfg(cmdlinecfg); + } + #endif + #ifdef CFGUSERPATH2 + // Get it in user directory (step 2) + if(not found) { + strxcpy(cmdlinecfg, CFGUSERPATH2, sizeof(cmdlinecfg)); + getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + found = FindCfg(cmdlinecfg); + } + #endif + #ifdef CFGPATH + // Get it in system config directory + if(not found) { + strxcpy(cmdlinecfg, CFGPATH, sizeof(cmdlinecfg)); + getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + found = FindCfg(cmdlinecfg); + } + #endif + // Get it in current directory if(not found) { getcwd(cmdlinecfg, sizeof(cmdlinecfg));