   MSVS project setup question
  Hi,I have set up a project in MSVS 2008, VC++ 9.0, that has folder-structure looking something like this://bin/<debug executable and dlls go here>/bin/<release executable and dlls go here>/resources/<resources root>/msvc9/<solution file goes here>/msvc9/foo/<project file for runnable project 'foo' goes here>When I build the solution, everything works well and the 'foo.exe' ends up in /bin. If I want to access the resources in the source code at run-time I use a relative path: "../resources". This works well when I run the built application from windows explorer, but when I build and run it from within MSVS it can't find the resources-path. I think the reason is that it looks for the path relative to the /msvc9/foo-folder, and not relative to the /bin folder. If I change the relative path in the source code to: "../../resources" it will work fine.What path settings do I need to change to get this right?I have done a "work-around", in that I have created two subfolders:/bin/release/bin/debugI think this structure looks pretty clean and I'll probably keep it, but I still want to know how to fix the relative paths issue.   
  Hello ... I use this function in order to make my resources paths relative to the path of the executable.Hope this helps...#include <windows.h>wstring GetPath(){    static wstring path;    static int i;    LPWSTR str = new wchar_t[256];    // get the path of the executable belonging to the running project    GetModuleFileName(GetModuleHandle(NULL) , str , 256);    // cut the name of the executable from the path    for(i = lstrlen(str) - 1 ; str != L'\\' ; i--)str = NULL;    // make the string empty    path = L"";    // copy the path in the path string    for(i = 0 ; str != NULL ; i++)path.push_back(str);    delete [] str;    str = NULL;return path;   }This way ... when you load in your resources you can load them by specifying this path: GetPath() + L"nameOfResourceIncludingExtension". Replace the L"nameOfResourceIncludingExtension" string with your resources names.The resources must be placed in the same folder as the executable.If you want your resources to go in a separate folder; <egz: Data>GetPath() + L"Data\\nameOfResourcePlusExtension". The Data folder must be in the same folder as the executable.The advantage of using this method is that you can move your executable and your resources anywhere in your computer and it will still work.-------------------------------------------------------------------------------------------My Website - Portfolio, Tutorials My blog;Quote:Original post by trasseltassWhat path settings do I need to change to get this right?You can specify from which directory to launch your executable from Visual Studio in project properties.Set Debugging->Working Directory to "../bin"Quote:The advantage of using this method is that you can move your executable and your resources anywhere in your computer and it will still work.If you use only relative paths (not absolute) you have same advantage. And you won't need such GetPath() function or unneeded string concatenations.;Quote:Original post by bubu LVQuote:Original post by trasseltassWhat path settings do I need to change to get this right?You can specify from which directory to launch your executable from Visual Studio in project properties.Set Debugging->Working Directory to "../bin"Thanks, that's what I was searching for. :) I'll try it out when I get home.