1

in my application, I use various resources. I specified pre-build events to copy my resources to output directory. My directory structure looks like this:

/Debug/Models/
/Debug/Shaders/
/Debug/Textures/
/Debug/sfero.exe
/Debug/...

I want to access these resources relative to the .exe file and that works fine when I run the executable directly from Debug folder, but when I run it in Visual Studio, it is being launched in different directory, thus I cannot access my resources. Obviously, I don't want to copy my resources to location from where Visual Studio runs my application.

Any suggestions? Thanks

Martin
  • 1,877
  • 5
  • 21
  • 37

2 Answers2

2

You can either make your application logic smarter about searching for resources, or you can pass command-line parameters (see the Debugging area of Project Properties) when launching from Visual Studio, passing the path where to look.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
2

The default current directory in Visual Studio is defined as $(ProjectDir) - which is by default the location of your vcproj file.

Go to your project's Properties -> Configuration Properties -> Debugging -> Working Directory and change it to $(SolutionDir)$(Configuration)\ or whatever your Output Directory points to.

Alexandru C.
  • 3,337
  • 1
  • 25
  • 27