'Failed to find shaders folder!'
Closed this issue · 4 comments
Hey! Thank you so much for this project, has been really useful to me. The ncurses version works great, but the Qt GUI crashes on the same place every time:
widgets/settings.cpp, line 458:
catch (filesystem::filesystem_error const& ex) {
if (i == 3) {
throw std::runtime_error("Failed to find shaders folder!");
return;
}
}
I have tried running the executable from the build directory (so that ../shaders/ would be valid), placed the shaders folder in ~/.config/recidia/shaders, as well as running the executable from the base directory. It never manages to find the folder, for some bizarre reason. The folder has all the right permissions. I suspect there might be a microscopic problem in the logic that only fails under certain circumstances, so I will do some debugging and see what I find. If you have any ideas, please let me know!
Thanks again!
Can't say for sure, but it might not be a "could not find file" error we are dealing with. Frankly I should of just included the "ex" variable from the catch. Something like this:
catch (filesystem::filesystem_error const& ex) {
if (i == 3) {
printf("Failed to find shaders folder!\n");
throw std::runtime_error(ex.what());
return;
}
}
Tell me what it spits out after including this code.
That left me with
what(): filesystem error: directory iterator cannot open directory: No such file or directory [/etc/recidia/shaders/]
and I fixed it by copying the shaders folder to there. Not sure why it only accepts that one path however. I made it print every path it checked and made sure they did actually exist.
Weird issue. But it works now, so thanks for your help!
Edit: Wait, I see what's happening. No matter if it's already found the shaders somewhere else, it will continue looking. If it doesn't find them at the last index, it will throw a runtime error no matter what.
OOOOOHHHHH.... I messed up bad, good work.
I fixed this with this commit: 4865ccc
I know it's a mess, but the solution was quite easy.
catch (filesystem::filesystem_error const& ex) {
continue;
}
}
if (shaderFiles.size() == 0)
throw std::runtime_error("Failed to find any shaders folder!");
If this fixed the problem please close the issue.
Thanks again.
That commit fixed it! :)