From 615ef6878ee3b6f6f646ec36d6f5900d86edcc6b Mon Sep 17 00:00:00 2001 From: ketmar Date: Mon, 25 Aug 2014 10:13:22 +0300 Subject: [PATCH] better "rgdc.rc" searching ($PWD/rgdc.rc, $HOME/.rgdc.rc, /etc/rgdc.rc, !) --- rgdc.d | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rgdc.d b/rgdc.d index f2ece3d..cd71896 100644 --- a/rgdc.d +++ b/rgdc.d @@ -669,7 +669,17 @@ int main(string[] args) { string outExt = (lib ? libExt : binExt); //collectException(readRC(thisExePath.setExtension(".rc"))); - collectException(readRC("rgdc.rc")); + foreach (fname; ["./rgdc.rc", "$(HOME)/.rgdc.rc", "/etc/rgdc.rc", "!"]) { + if (fname == "!") fname = thisExePath.setExtension(".rc"); + else fname = expandString(fname); + try { + //writeln("trying '", fname, "'"); + readRC(fname); + break; + } catch (Exception e) { + //writeln(" FAILED! ", e.msg); + } + } // --build-only implies the user would like a binary in the program's directory if (buildOnly && !exe) exe = exeDirname~dirSeparator; -- 2.11.4.GIT