PDA

View Full Version : Confirm data folder accessibility??



NewsArchive
05-04-2013, 07:53 AM
Hi All,

If, during the install, the user is allowed to select the location where
their data files will be installed, how do I confirm the folder they
have selected is accessible and writable from the application if they
have UAC turned on? Which they most likely will.

Thanks

--
*Regards*,

Lee
www.cya2day.com
CYA - Don't Leave Home Without One
The Hurrier I Go The Behinder I Get

NewsArchive
05-04-2013, 07:55 AM
Lee,

First of all, I assume that your installer requests administrator execution
level privileges and runs elevated. In this case, it has write access to
protected folders and you don't need to check this (even if UAC is
enabled -- and most users have it enabled).

But your own application runs non-elevated by default (if you are following
the Windows development guidelines). As a result, your own application does
NOT have write access to those protected areas.

You can use the "If Folder is not writable" script statement to try to check
if a folder is writable. But from the elevated running setup.exe it will
tell you that it *IS* writable. Your own app does not have write access.
So this information can't help.

To sum it up, there is no reliable way to check if the "user" that will be
running your application has write access to the folder. "User" is an
already existing user or a possible user created in the future.

That's why you ALWAYS have to install the data files "per-machine" and your
own application has to copy it from that global location to the "per-user"
location at first application start. That is the recommended (UAC-aware)
solution.

Friedrich