Jump to content
  • Advertisement
Sign in to follow this  
Wibbs

VS2008 Project working directory when running in debug through IDE

This topic is 3175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I've just set up a new project in VS2008, and part of my program writes to file. When I run the exe as stand alone it puts the file in the exe's directory, but if I run it through the debugger in the IDE it puts it somewhere else. I used to know where to make the necessary change in the project settings, but can't for the life of me find it. I thought it was Project Properties, Configuration Properties, General, Output Directory, but I've changed this and it doesnt seem to have made any difference. Any help would be gratefully appreciated. Thanks, Wibbs

Share this post


Link to post
Share on other sites
Advertisement
It's Project, Properties, Configuration Properties, Debugging, Working Directory.

Do bear in mind that writing to the application's own directory is something that's not liable to work properly under a non-administrator account (which is the norm on Vista and up) assuming the application is installed in Program Files.

Share this post


Link to post
Share on other sites
Ah, thanks for the info. Your comment relating to inability to save in certain locations raises another question though. How do you access the (what I assume would be) environment variables that give the paths to the currently logged on users area of the hard drive where they can save stuff?

Share this post


Link to post
Share on other sites
Take a look at GetEnvironmentVariable(). Users should have (at least) an environment variable named "TEMP" for which you can get a string for the path.

If you're working on a network or other controlled environment, the admin should be able to give you the name of an environment variable (if any) for a logged-on user's area. You then use that function to obtain the path.

Share this post


Link to post
Share on other sites
On Windows, you can avoid messing with environment variables and use SHGetKnownFolderPath.

Settings for your game that the game exe needs to write to outside of installation are normally stored in the local app data directory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!