View Full Version : [Hammer] run game on compilation and compiler path issues

17-05-2016, 07:36 AM
Hammer fails to run maps if it launches the game after compiling. This is because the current working directory for the game is set to Hammer's directory, so the game's file I/O calls (except for SteamPipe) go to the wrong place. Make Hammer set the directory to svencoop.exe's directory to fix this.

Compiler paths may have spaces in it, which results in the path being parsed as multiple parameters by compile tools. To fix this, surround the path with quotes in Hammer's command execution code.
This doesn't happen for everyone: some people have long paths which Windows truncates using the 8.3 format (https://en.wikipedia.org/wiki/8.3_filename), which tends to remove spaces. Hammer uses Windows's API for getting short paths, which is why it does this.

20-05-2016, 05:06 AM
To add to the working directory issue: if the game is started using CreateProcess, you can specify the directory using the lpCurrentDirectory parameter: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx

Should be trivial to fix. Just extract the directory from the game exe filename.