Here is the scenario. I have an application which writes a configuration file in its directory (user.dir
). When the user cannot write to that directory due to UAC issues, I would like to change that to write to user.home/.appname/
. The problem is that Windows really lies to my application and writes to user.dir
which is in the Program Files directory, but although it allows the write and the read (even after restarts) it doesn't store it there, it stores it in a hidden directory (the home directory/AppData/Local/VirtualStore/Program Files/appname), making it hard/impossible for the user to find if they want to edit the file.
However, I don't want to just change my application to write to user.home
and be done with it because some users run the application off of a USB drive, at which point I want to use user.dir
if it is available, because it would not be helpful to leave things around the user home directory in that scenario (on a guest computer).
So after that rather long winded background, is there a way from java to know if the local directory is really truly directly writable from Java or if vista is going to instead virtualize the directory writes to another location?