001package org.hl7.fhir.utilities; 002 003import java.io.IOException; 004 005public class ToolGlobalSettings { 006 007 private static boolean inited = false; 008 009 private static String npmPath; 010 private static String rubyPath; 011 private static String testsPath; 012 private static String comparePath; 013 private static String tempPath; 014 private static String testIgsPath; 015 016 public static String getNpmPath() { 017 init(); 018 return npmPath; 019 } 020 public static String getRubyPath() { 021 init(); 022 return rubyPath; 023 } 024 public static String getTestsPath() { 025 init(); 026 return testsPath; 027 } 028 029 public static boolean hasNpmPath() { 030 init(); 031 return npmPath != null; 032 } 033 034 public static boolean hasRubyPath() { 035 init(); 036 return rubyPath != null; 037 } 038 public static boolean hasTestsPath() { 039 init(); 040 return testsPath != null; 041 } 042 043 public static String getComparePath() { 044 init(); 045 return comparePath; 046 } 047 public static boolean hasComparePath() { 048 init(); 049 return comparePath != null; 050 } 051 052 public static String getTempPath() { 053 init(); 054 return tempPath; 055 } 056 public static boolean hasTempPath() { 057 init(); 058 return tempPath != null; 059 } 060 061 public static String getTestIgsPath() { 062 init(); 063 return testIgsPath; 064 } 065 public static boolean hasTestIgsPath() { 066 init(); 067 return testIgsPath != null; 068 } 069 070 private static void init() { 071 if (!inited) { 072 inited = true; 073 IniFile ini; 074 try { 075 ini = new IniFile(Utilities.path(Utilities.path(System.getProperty("user.home"), ".fhir", "fhir-tool-settings.conf"))); 076 if (ini.hasSection("paths")) { 077 npmPath = ini.getStringProperty("paths", "npm"); 078 rubyPath = ini.getStringProperty("paths", "ruby"); 079 testsPath = ini.getStringProperty("paths", "tests"); 080 comparePath = ini.getStringProperty("paths", "compare"); 081 tempPath = ini.getStringProperty("paths", "temp"); 082 testIgsPath = ini.getStringProperty("paths", "test-igs"); 083 } 084 } catch (IOException e) { 085 } 086 } 087 } 088}