Source:
public static String getApplicationDataDirectory() { String filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY; if (filepath == null) { filepath = System.getProperty("OPENMRS_APPLICATION_DATA_DIRECTORY"); } if (filepath == null) { filepath = Context.getRuntimeProperties().getProperty( OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); } if (filepath == null) { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + ".OpenMRS"; if (!(new File(filepath)).canWrite()) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + "OpenMRS"; } } else { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + ".OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + "OpenMRS"; } } else { filepath = System.getProperty("user.home") + File.separator + "Application Data" + File.separator + "OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN + File.separator + "OpenMRS"; } } } filepath = filepath + File.separator; } OpenmrsConstants.APPLICATION_DATA_DIRECTORY = filepath; File folder = new File(filepath); if (!folder.exists()) { folder.mkdirs(); } return filepath; }

Target:
public static String getApplicationDataDirectory() { String filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY; String systemProperty = System.getProperty("OPENMRS_APPLICATION_DATA_DIRECTORY"); if (systemProperty != null) { filepath = systemProperty; } else { String runtimeProperty = Context.getRuntimeProperties().getProperty( OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (runtimeProperty != null) { filepath = runtimeProperty; } } if (filepath == null) { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + ".OpenMRS"; if (!(new File(filepath)).canWrite()) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + "OpenMRS"; } } else { if (OpenmrsConstants.UNIX_BASED_OPERATING_SYSTEM) { filepath = System.getProperty("user.home") + File.separator + ".OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_UNIX + File.separator + "OpenMRS"; } } else { filepath = System.getProperty("user.home") + File.separator + "Application Data" + File.separator + "OpenMRS"; if (!canWrite(new File(filepath))) { log.warn("Unable to write to users home dir, fallback to: " + OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN); filepath = OpenmrsConstants.APPLICATION_DATA_DIRECTORY_FALLBACK_WIN + File.separator + "OpenMRS"; } } } filepath = filepath + File.separator; } File folder = new File(filepath); if (!folder.exists()) { folder.mkdirs(); } OpenmrsConstants.APPLICATION_DATA_DIRECTORY = filepath; return filepath; }