From 348b78be9dfee643cc45c4fd9277e2211fd2c445 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Sat, 21 Jan 2006 00:54:18 +0000 Subject: [PATCH] Search config file sequence is changed --- docs/notework.txt | 16 ++++++++++++++++ golded3/gefn.h | 4 +++- golded3/geinit.cpp | 9 +++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 03363d4..5b5f771 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,22 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +! Search config file sequence (*nix): + command line option "-C", + enviroment variable "GOLDED" (filename), + file ${GOLDED}/golded.conf, + file ${GOLDED}/golded.cfg, + enviroment variable "GED" (filename), + file ${GED}/golded.conf, + file ${GED}/golded.cfg, + file ~/.golded, + file ~/.golded/golded.conf, + file ~/.golded/golded.cfg, + file ~/golded.conf, + file ~/golded.cfg, + file /usr/local/etc/golded.conf, + file /usr/local/etc/golded.cfg. + - If AREAFILE fidoconfig not exists or can't be opened then Golded+ is printing the diagnostic message. diff --git a/golded3/gefn.h b/golded3/gefn.h index 81b8dc9..420a402 100644 --- a/golded3/gefn.h +++ b/golded3/gefn.h @@ -40,6 +40,8 @@ #define GEDCFG2 "gedw32.cfg" #elif defined(__DOS__) || defined(__MSDOS__) #define GEDCFG2 "geddos.cfg" + #elif defined(__UNIX__) + #define GEDCFG2 "golded.conf" #endif #endif /* GEDCFG2 */ @@ -98,7 +100,7 @@ #ifndef CFGUSERPATH1 #ifdef __UNIX__ -#define CFGUSERPATH1 "~/.golded/" +#define CFGUSERPATH1 "~/.golded" #endif #endif diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index daa17ff..e7d3999 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -458,6 +458,7 @@ static bool FindCfg(char* path) { return false; } AddBackslash(path); + #ifdef GEDCFG2 found = ExistCfg(path, GEDCFG2); #endif @@ -561,7 +562,7 @@ void Initialize(int argc, char* argv[]) { // Print commandline help and exit if requested if (cmdlinehelp) - { + { STD_PRINTNL("Copyright (C) 1990-2005 Odinn Sorensen, Alexander Aganichev, Jacobo Tarrio,"); STD_PRINTNL(" Stas Degteff and others"); STD_PRINTNL("-------------------------------------------------------------------------------"); @@ -631,7 +632,7 @@ void Initialize(int argc, char* argv[]) { // Get it in user directory (step 1) if(not found) { strxcpy(cmdlinecfg, CFGUSERPATH1, sizeof(cmdlinecfg)); - getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + strschg_environ(cmdlinecfg); found = FindCfg(cmdlinecfg); } #endif @@ -639,7 +640,7 @@ void Initialize(int argc, char* argv[]) { // Get it in user directory (step 2) if(not found) { strxcpy(cmdlinecfg, CFGUSERPATH2, sizeof(cmdlinecfg)); - getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + strschg_environ(cmdlinecfg); found = FindCfg(cmdlinecfg); } #endif @@ -647,7 +648,7 @@ void Initialize(int argc, char* argv[]) { // Get it in system config directory if(not found) { strxcpy(cmdlinecfg, CFGPATH, sizeof(cmdlinecfg)); - getcwd(cmdlinecfg, sizeof(cmdlinecfg)); + strschg_environ(cmdlinecfg); found = FindCfg(cmdlinecfg); } #endif