Hello. I was trying to play the newly released Death Wish 2.0 expansion using this sourceport, but when I tried to save, the following error from loadsave.cpp was getting thrown:
hSFile = fopen(saveFileName, "wb");
if (hSFile == NULL)
ThrowError("File error #%d creating save file.", errno);
I've done a bit of digging and came to the following conclusions:
1.I like to keep my blood installation tidy, thus I've made a separate directory for it called dw which lived inside the game directory
2.I had a simple bash script written, which launched the game in the following way: nblood -game_dir dw -ini dw.ini, which led to the g_modDir being set inside the C++ program and later inside the nblood.cfg config file
3.When I tried to save, the macro G_ModDirSnprintf set the savePath to dw/game0000.sav (or some similar value)
4.fopen was called with $HOME/.config/nblood/dw/game000.sav but since dw file didn't exist, it returned NULL (fopen cannot create directories, only files) and led to the crash happening
The fix to this issue should be to simply ensure that the parent directory exists when calling the fopen (or to use some other function that can handle creating them). For now, I've simply created $HOME/.config/nblood/dw directory and saving works now, but this is a workaround that will require me to create similar dir for every new modpack that I play, which is quite annoying.
Hello. I was trying to play the newly released
Death Wish 2.0expansion using this sourceport, but when I tried to save, the following error fromloadsave.cppwas getting thrown:I've done a bit of digging and came to the following conclusions:
1.I like to keep my blood installation tidy, thus I've made a separate directory for it called
dwwhich lived inside the game directory2.I had a simple bash script written, which launched the game in the following way:
nblood -game_dir dw -ini dw.ini, which led to theg_modDirbeing set inside the C++ program and later inside thenblood.cfgconfig file3.When I tried to save, the macro
G_ModDirSnprintfset the savePath todw/game0000.sav(or some similar value)4.
fopenwas called with$HOME/.config/nblood/dw/game000.savbut sincedwfile didn't exist, it returned NULL (fopen cannot create directories, only files) and led to the crash happeningThe fix to this issue should be to simply ensure that the parent directory exists when calling the
fopen(or to use some other function that can handle creating them). For now, I've simply created$HOME/.config/nblood/dwdirectory and saving works now, but this is a workaround that will require me to create similar dir for every new modpack that I play, which is quite annoying.