Merge pull request #1436 from hapifhir/do-20230913-remove-env-vars-from-pathbuilder

Remove env variables from paths
This commit is contained in:
Grahame Grieve 2023-09-15 12:06:56 -07:00 committed by GitHub
commit f9e514a8b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 13 deletions

View File

@ -175,13 +175,6 @@ public class PathBuilder {
}
} else if ("[user]".equals(a)) {
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;
}

View File

@ -13,6 +13,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.SystemUtils;
import org.hl7.fhir.utilities.settings.FhirSettings;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
@ -59,12 +60,6 @@ class UtilitiesTest {
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() {
String os = SystemUtils.OS_NAME;
if (os.contains(OSX) || os.contains(MAC)) {