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

Robert Jordan robertj at gmx.net
Thu Nov 27 09:46:01 EST 2008


Xavi de Blas 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?

Yes: don't store writable data into "Program Files". This is a
a requirement since Windows 2000 and since Unix 1970.

Writable data for all users must be stored into

Path.Combine(
Environment.GetFolder(Environment.SpecialFolder.CommonApplicationData),
"Your App's Name")

Writable data for the current user:

Path.Combine(
Environment.GetFolder(Environment.SpecialFolder.LocalApplicationData),
"Your App's Name")

Writable data for the current roaming user:

Path.Combine(
Environment.GetFolder(Environment.SpecialFolder.ApplicationData),
"Your App's Name")


Robert



More information about the Mono-list mailing list