Remove env variables from paths

This commit is contained in:
dotasek 2023-09-13 23:03:16 -04:00
parent a8967b378f
commit 57f7e2d0ee
2 changed files with 1 additions and 13 deletions

View File

@ -175,13 +175,6 @@ public class PathBuilder {
} }
} else if ("[user]".equals(a)) { } else if ("[user]".equals(a)) {
return System.getProperty("user.home"); return System.getProperty("user.home");
} else if (a.startsWith("[") && a.endsWith("]")) {
String ev = System.getenv(a.replace("[", "").replace("]", ""));
if (ev != null) {
return ev;
} else {
return "null";
}
} }
return a; return a;
} }

View File

@ -13,6 +13,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.SystemUtils; import org.apache.commons.lang3.SystemUtils;
import org.hl7.fhir.utilities.settings.FhirSettings; import org.hl7.fhir.utilities.settings.FhirSettings;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.EnabledOnOs;
@ -59,12 +60,6 @@ class UtilitiesTest {
assertEquals(Utilities.path("[user]", TEST_TXT), getUserDirectory() + TEST_TXT); assertEquals(Utilities.path("[user]", TEST_TXT), getUserDirectory() + TEST_TXT);
} }
@Test
@DisplayName("Test Utilities.path maps JAVA_HOME correctly")
public void testJavaHomeDirPath() throws IOException {
assertEquals(Utilities.path("[JAVA_HOME]", TEST_TXT), getJavaHomeDirectory() + TEST_TXT);
}
private String getJavaHomeDirectory() { private String getJavaHomeDirectory() {
String os = SystemUtils.OS_NAME; String os = SystemUtils.OS_NAME;
if (os.contains(OSX) || os.contains(MAC)) { if (os.contains(OSX) || os.contains(MAC)) {