Jim - 2011-07-26

I had a look into this, and I see that the relevant code is in XmlConfigurationService.java, specifically the line:

public static final String DEFAULT_CONFIG_DIRECTORY = System.getProperty("user.home") + "/.pdfsam"

From what I've read, the best way to get the app data directory is to use System.getenv("APPDATA"), so perhaps you could check whether System.getProperty("os.name") contains "Windows", or just check if the APPDATA env variable is non-empty, and if so use that.

Having a bit more of a look, it seems like the "correct" way to do this in Java is to abandon the platform-specific code altogether (both the Windows stuff I'm proposing, and the Unix stuff that's already there), and use the Java Preferences API, which stores things in the correct location whatever to OS. As a benefit this would also mean that you wouldn't have to manipulate config files and their contents, giving you less code to maintain. But, I realise this would be a big change.