I have customised my Visual Studio (2010 express) project settings to separate project, source, temp, debug build, release build files, etc. in to appropriate sub-folders. The application I have created, when run in either debug or release mode, creates a config file (CreateFile()), but rather than creating that file in the debug or release directory it is created along side the project (.sln, .vxproj) files. It doesn't cause any problems other than separation of files that I'd like to ultimately ship together. When running the executables independently the files are created in the correct folder, alongside the exe. Can anyone advise me which project settings I need to adjust in order to get round this issue? Thanks.
1 reply to this topic
Moderators - Reputation: 9490
Posted 17 March 2013 - 01:12 PM
Goto Debugging/Working Directory to change the working directory of the executable. Keep in mind, however, that there are ways to launch your an application in normal use that won't set the working directory to the executable directory when deployed, so if you depend on a file being created in the same directory as the executable, you should manually find the directory. Of course, the other part of the problem is that on recent versions of Windows the Program Files directories are locked for writing new files, so you should create application specific data in the ProgramData directory and per user information in the appropriate user AppData directory.