aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-03-02 15:03:34 +0100
committerBjörn Gustavsson <[email protected]>2017-03-02 15:33:44 +0100
commit74e9234a87f6fac98900201a481696b31df2bdab (patch)
tree8684209adb60df8097fab6d3aa8673f4c32267c3 /lib/observer
parent369ef2ee5586e5cad2f16f0b8f956be011ba1550 (diff)
downloadotp-74e9234a87f6fac98900201a481696b31df2bdab.tar.gz
otp-74e9234a87f6fac98900201a481696b31df2bdab.tar.bz2
otp-74e9234a87f6fac98900201a481696b31df2bdab.zip
dialyzer, observer: Use portable lookup of home directory
Use init:get_argument(home) to find the location of the home directory. That will work on all platforms (including Windows). Note that the run-time system will fail to start if HOME (or the equivalent on Windows) is not set. Therefore, it can be assumed that init:get_argument(home) will not fail. ERL-161
Diffstat (limited to 'lib/observer')
-rw-r--r--lib/observer/src/observer_wx.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/observer/src/observer_wx.erl b/lib/observer/src/observer_wx.erl
index 3031a1f90d..83de4fa64c 100644
--- a/lib/observer/src/observer_wx.erl
+++ b/lib/observer/src/observer_wx.erl
@@ -636,7 +636,8 @@ create_connect_dialog(connect, #state{frame = Frame}) ->
wxWindow:setSizerAndFit(Dialog, VSizer),
wxSizer:setSizeHints(VSizer, Dialog),
- CookiePath = filename:join(os:getenv("HOME"), ".erlang.cookie"),
+ {ok,[[HomeDir]]} = init:get_argument(home),
+ CookiePath = filename:join(HomeDir, ".erlang.cookie"),
DefaultCookie = case filelib:is_file(CookiePath) of
true ->
{ok, Bin} = file:read_file(CookiePath),