Sign in to follow this  
EJH

Writing to files in Vista/XP (user accounts)

Recommended Posts

So, in Vista your game cannot write to files outside of the user's personal directory (Documents and Setting/user) unless the game is run in Administrator mode. What is the best way to handle this? Any good tutorials on setting up the app and installer for it? Is there an easy way to dynamically determine the user's folder path in C#/XNA? Is it different in Vista/XP? [Edited by - EJH on June 2, 2009 11:00:34 AM]

Share this post


Link to post
Share on other sites
This covers all you need to know with regards to locations and what you should write where.

I'm sure C# has ways of accessing this folder information as well.

As for an installer, use something like NSIS to create it; the user will still need to run it as admin in order to write the files for the install, however after that if you've done things correctly with regards to where you write data they shouldn't have to after that.

Share this post


Link to post
Share on other sites
For XNA, you can just use the StorageContainer to figure it out for you. It will make sure user files get stored in an appropriate place.

Outside of XNA you typically use the System.Windows.Forms.Application class to handle this stuff for you, but you're probably not using that if you're using XNA.

Share this post


Link to post
Share on other sites
Windows XP also has restricted user accounts - do not assume that the current user running your application has write access everywhere.

Also, as a note to what phantom said above, you can create installers which do not require administrator privileges. In fact I think you should aim to make it possible - do not require administrator privileges for the installer if it is not technically required by what the installer needs to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this