[Mono-list] Howto manage Vista AppData\VirtualStore folder from a Mono app?

Benjamin Podszun ben at galactic-tales.de
Thu Nov 27 09:26:41 EST 2008


Hi.

On Thu, 27 Nov 2008 15:04:41 +0100, "Xavi de Blas" <xaviblas at gmail.com>
wrote:
> Hello all
> 
> My app on Windows is usally installed here:
> C:\ProgramFiles\Chronojump
> 
> and an sqlite file is here:
> C:\ProgramFiles\Chronojump\database\chronojump.db
> and logs are written here:
> C:\ProgramFiles\Chronojump\logs\
> 
> but on Windows Vista it doesn't allow the app to use this file
> locations, and it uses user dirs like:
> 
> C:\Users\(user)\AppData\VirtualStore\Program files
> 
> Then there are two versions of the database and all i'ts a mess
> 
> Is there any decent way to solve this?

Sorry for this answer, but - your code is broken for Vista and broken for
somewhat sane XP setups as well. Not to mention Linux or anything. A user
shouldn't be able to write to the program files folder (and Vista enforces
that with this "redirect it to some place else" crap for legacy support).
If at all possible I'd recommend "fixing" your app by using
Environment.GetFolderPath(). Probably for SpecialFolder.
CommonApplicationData, SpecialFolder.ApplicationData or
SpecialFolder.LocalApplicationData. Your app, you should know what fits
best.

Regards,
Ben



More information about the Mono-list mailing list