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?

4
  • per my recollection Win 7 has somewhat difficult to deal with UAC that was usually involved in issues like you describe
    – gnat
    Commented Apr 8, 2016 at 9:39
  • @gnat That directory should be user writable and UAC shouldn't cause problems. Commented Apr 8, 2016 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
    Commented Apr 8, 2016 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
    Commented Apr 8, 2016 at 15:12

1 Answer 1

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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.