2

My Windows desktop app creates a file in:

%LOCALAPPDATA%\XYZZY Software\Our Product\foobar.json

One customer on Windows 7 is experiencing "Accessed Denied" errors when our software tries to overwrite this file. This file was created by our desktop app, exactly where Microsoft recommends our app saves its internal data.

How should our desktop software handle this situation?

  • per my recollection Win 7 has somewhat difficult to deal with UAC that was usually involved in issues like you describe – gnat Apr 8 '16 at 9:39
  • @gnat That directory should be user writable and UAC shouldn't cause problems. – CodesInChaos Apr 8 '16 at 10:15
  • 1
    The likely solution is to not save to %LOCALAPPDATA% (which, for pure roaming profiles will not be user-writable), but to save to %APPDATA% instead. – David Arno Apr 8 '16 at 10:15
  • Are you sure the write to / create of the file the succeeds first time, and only gets an error overwriting the file (e.g. a later operation)? – Erik Eidt Apr 8 '16 at 15:12
2
  1. First, make sure this does not happen because of an error in your application. Seriously!

  2. Display a clear error message that your app cannot save the file. Within that message, recommend the user to check if the access rights are misconfigured. Mention also the possibility a virus scanner could have blocked the access.

  3. Ask the user if he wants to retry saving the file. If the data is really important and must not get lost, offer him a choice to save it in a different folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.