diff options
author | Fredrik Gustafsson <[email protected]> | 2013-02-12 12:08:37 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-02-12 12:08:37 +0100 |
commit | 5bb22560c350baa834196835640a5aab21e97f8a (patch) | |
tree | 68e515fcb375468145211d3f6adbc067db1e24a0 /lib | |
parent | 837d81ae4d1e032e91bbc8f8a54158f5ec61c707 (diff) | |
parent | aadc5c595708f80719c5e07ca0f8b01b6ac300ce (diff) | |
download | otp-5bb22560c350baa834196835640a5aab21e97f8a.tar.gz otp-5bb22560c350baa834196835640a5aab21e97f8a.tar.bz2 otp-5bb22560c350baa834196835640a5aab21e97f8a.zip |
Merge branch 'vd/jinterface_windows_cookie/OTP-10821'
* vd/jinterface_windows_cookie/OTP-10821:
jinterface: fix finding cookie file on windows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java index cea5080607..968f284bff 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java @@ -118,8 +118,9 @@ public class AbstractNode { localHost = "localhost"; } - final String dotCookieFilename = System.getProperty("user.home") - + File.separator + ".erlang.cookie"; + final String homeDir = getHomeDir(); + final String dotCookieFilename = homeDir + File.separator + + ".erlang.cookie"; BufferedReader br = null; try { @@ -251,4 +252,15 @@ public class AbstractNode { public String toString() { return node(); } + + private static String getHomeDir() { + final String home = System.getProperty("user.home"); + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + final String drive = System.getenv("HOMEDRIVE"); + final String path = System.getenv("HOMEPATH"); + return (drive != null && path != null) ? drive + path : home; + } else { + return home; + } + } } |