/** * just plain wrong in case the programfiles are not stored where the developer expects them. E.g. * in custom installations of large companies or if used internationalized version of windows with * a language pack. * * @return the program files path */ private String buildWindowsDefaultPathFromProps() { StringBuffer dpath = new StringBuffer(""); try { // We load the properties Properties props = new Properties(); props.load( InstallerBase.class.getResourceAsStream( "/com/izforge/izpack/installer/win32-defaultpaths.properties")); // We look for the drive mapping String drive = System.getProperty("user.home"); if (drive.length() > 3) { drive = drive.substring(0, 3); } // Now we have it :-) dpath.append(drive); // Ensure that we have a trailing backslash (in case drive was // something // like "C:") if (drive.length() == 2) { dpath.append("\\"); } String language = Locale.getDefault().getLanguage(); String country = Locale.getDefault().getCountry(); String language_country = language + "_" + country; // Try the most specific combination first if (null != props.getProperty(language_country)) { dpath.append(props.getProperty(language_country)); } else if (null != props.getProperty(language)) { dpath.append(props.getProperty(language)); } else { dpath.append(props.getProperty(Locale.ENGLISH.getLanguage())); } } catch (Exception err) { dpath = new StringBuffer("C:\\Program Files"); } return dpath.toString(); }