String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }
EnvironmentCalculator hc = new EnvironmentCalculator(isWindows); home = hc.getHome();
EnvironmentCalculator hc = new EnvironmentCalculator(isWindows); home = hc.getHome();
String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
String getSystemEnv(String key, Set<String> visited) { String value = getenv(key); if (value == null || !iswindows) { return value; } if (visited == null) { visited = new HashSet<>(); } else if (visited.contains(key)) return key; visited.add(key); StringBuffer sb = new StringBuffer(); Matcher matcher = WINDOWS_MACROS.matcher(value); int append = 0; while (matcher.find(append)) { String name = matcher.group(1); String replacement = getSystemEnv(name, visited); while (append < matcher.start()) { sb.append(value.charAt(append)); append++; } sb.append(replacement); append = matcher.end(); } while (append < value.length()) { sb.append(value.charAt(append)); append++; } return sb.toString(); }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }
/** * Get the value of a system environment variable. Expand any macros * (%...%) if run on windows. Generally, on Linux et. al. environment * variables are already expanded. * * @param key the environment variable name * @return the value with expanded macros if on windows. */ String getSystemEnv(String key) { return getSystemEnv(key, null); }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }
File getHome() { File tmp = testFile(getSystemEnv("HOME")); if (tmp == null || !tmp.isDirectory()) { tmp = testFile(System.getProperty("user.home")); } assert tmp != null; return tmp; }