Permalink
Browse files

831: fix jinterface default cookie handling on Windows

  • Loading branch information...
1 parent f170282 commit 957d1191cde7d208480777b9d0cb82c145875785 @vladdu vladdu committed Jan 23, 2013
Showing with 20 additions and 7 deletions.
  1. +20 −7 org.erlide.libs/src/com/ericsson/otp/erlang/AbstractNode.java
@@ -1,20 +1,20 @@
/*
* %CopyrightBegin%
- *
+ *
* Copyright Ericsson AB 2000-2009. All Rights Reserved.
- *
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
- * %CopyrightEnd%
+ *
+ * %CopyrightEnd%
*/
package com.ericsson.otp.erlang;
@@ -118,8 +118,9 @@
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,16 @@ public String setCookie(final String cookie) {
public String toString() {
return node();
}
+
+ private static String getHomeDir() {
+ final String u = System.getProperty("user.home");
+ if (System.getProperty("os.name").toLowerCase().contains("windows")) {
+ final String d = System.getenv("HOMEDRIVE");
+ final String p = System.getenv("HOMEPATH");
+ return (d != null && p != null) ? d + p : u;
+ } else {
+ return u;
+ }
+ }
+
}

0 comments on commit 957d119

Please sign in to comment.