summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Wallace <mikewallace1979@googlemail.com>2014-08-04 16:14:20 +0100
committerJay Doane <jaydoane@apache.org>2021-04-19 00:34:24 -0700
commit3f843a21429d1eb7bda6e7d3e2c385c7c96f7574 (patch)
treeabcfb4ee71024b2a8f9bab73e85e9f0c3e4a3f51
parent9ea89911cad4d66c0c1abbb2218a989fbabfc850 (diff)
downloadcouchdb-3f843a21429d1eb7bda6e7d3e2c385c7c96f7574.tar.gz
Improve default etc directory
This commit sets the default etc directory location relative to the path of the escript. This will be the correct location when the weatherreport escript is included in the bin directory of a release. BugzID: 32856
-rw-r--r--src/weatherreport/src/weatherreport_config.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/weatherreport/src/weatherreport_config.erl b/src/weatherreport/src/weatherreport_config.erl
index 57c7e0b43..7dc5d863f 100644
--- a/src/weatherreport/src/weatherreport_config.erl
+++ b/src/weatherreport/src/weatherreport_config.erl
@@ -92,7 +92,8 @@ user() ->
etc_dir() ->
case application:get_env(weatherreport, etc) of
undefined ->
- filename:absname("./etc", ".");
+ ExecDir = filename:absname(filename:dirname(escript:script_name())),
+ filename:join(ExecDir, "../etc");
{ok, Path} ->
filename:absname(Path, "/")
end.