rmtew / incursion-roguelike

The legendary computer game Incursion: Hall of the Goblin King!
https://incursion-roguelike.net/
Other
7 stars 1 forks source link

Inconsistant working directory #1

Closed HexDecimal closed 2 months ago

HexDecimal commented 2 months ago

The executable does some strange stuff with the working directly. It seems to decide to change its directory when a debugger is attached which seems like strange behavior. Since Incursion.exe -compile needs to be run from the project directory I tried to run it from there instead of moving the executable but it decided to look for files relative to the executable instead of the working directory where I ran the command.

https://github.com/rmtew/incursion-roguelike/blob/5d1c41549dad89fc756233fed22055347a5488ea/src/Wlibtcod.cpp#L336-L369

The only thing here I find reasonable is checking if a path from an environment variable should be used. This should not check argv[0] to find the directory. This should not check _getcwd. This should not change behavior depending on if a debugger is attached.

Visual Studio's configured working directory should be changed to $(SolutionDir)\.. and nearly all of this code should be removed.

rmtew commented 2 months ago

It should definitely do the simplest thing possible.