Issue moving between computers and still loading all files inside /data/

Hi All!

I’ve been having this little bug and I just can’t seem to find a solution so I figured someone on here might know. Generally for work I develop in Visual Studio on my main desktop computer. I commit everything to github ( except the build folders and .sdf databases to save some git space ) when I pull it onto a new machine ( say my laptop ) the project builds and compiles successfully but it doesn’t seem to be able to load any actual assets while debugging through visual studio.

If I simply build the project then double click to open the .exe everything loads fine ! So it’s not the end of the world it’s just annoying that I can’t really debug from within visual studio without copying over all my paths and readding all my dependencies to a fresh project via the solution explorer. The readouts just say that no assets are found, or are unable to load fonts/ images/ videos from the paths I provide. I’ve run into this problem before when using the useful Restart on Crash ( http://www.softpedia.com/get/System/File-Management/Restart-on-Crash.shtml ) If I just select the application to be relaunched it tries to load / launch the app from wherever restart on crash is and not where the application path is so I get these same pathing issues. To fix this issue with restart on crash I point the restart command to a windows batch script that first changes directory to the correct path and then calls “start” on my .exe. Does anyone know if this is easily done inside Visual Studio ? I’m able to add in linker and search paths but I haven’t messed around with the build / post build commands too much. My hunch is that somewhere along the lines I’m setting an absolute path on a machine and this is getting read on my secondary machine that has a different username / file structure.

Any or all suggestions would be totally awesome ! Thanks.

You can try adding paths to your PATH environment variable from within Visual Studio. From the project properties, go to Configuration Properties -> Debugging -> Environment. In the field, type in something like

  
PATH=PATH;<searchPath>  

where is the full path you want included. If you have more search paths to add, append with a semicolon in between. When you launch a program from VS, this should tell VS to also search these paths for any needed files. Oh, and don’t forget that you would need to set this Environment field for any configurations you want to use (Debug, Release, etc).

can you take a look and see that this is set properly?

this tells the debugger, run this code from the folder where it’s being built. If this is set wrong, the debugger will run it from the wrong spot (thus no loading of assets / can’t find data folder).

system(“cd”);

which on windows is like “pwd” on linux might also help explain where this app thinks it’s current working directory is.

hope that helps,
zach

Hey Zach,

Thanks for the input, you were right by changing the output path to simply “./bin” everything works correctly ! This saved me so much wasted time moving between machines. Thanks again !