Details
-
Bug
-
Status: Closed
-
Should
-
Resolution: Fixed
-
Core 2.4.0
-
None
Description
To determine the OpenMRS application directory, we use this function, which looks for either a environment property or a runtime property first before falling back to a default directory. On UNIX, we default to something like ~/.OpenMRS and fall back to /var/lib/OpenMRS, which is pretty close to Unix conventions. However, on Windows we use this bit of code:
filepath = System.getProperty("user.home") + File.separator + "Application Data" + File.separator + "OpenMRS";
The intention here looks to be to get a directory like %USERPROFILE%\Application Data\OpenMRS. On Windows XP, this would've expanded to something like C:\Documents and Settings\<user name>\Application Data\OpenMRS, which is correct, but on Windows Vista and especially newer Windows systems, this expands to C:\Users\<user name>\Application Data\OpenMRS, which is incorrect. The easy fix for this would be to replace the hard-coded string "Application Data" with the correct environment variable:
filepath = filepath = System.getenv("appdata") + File.separator + "OpenMRS";
Which should expand properly on both XP and, more importantly, on more recent versions of Windows.