nehe-tuts
nehe-tuts copied to clipboard
Paths_nehe_tuts.hs gives broken absolute path
We use the path to the data dir from the cabal provided modules but when the path is not defined or defined incorrect we get segfaults. Really this points to two separate issues:
- Don't trust the path from that module, and check it so we don't segfault
- Use a different mechanism that provides relative paths or is otherwise less brittle to how people build the examples vs. how they run them.
After trying to compile lesson6 and up GHC complained about a the module Paths_nehe_tuts being missing. After adding the file Paths_nehe_tuts.hs with the following contents it worked fine (given that you have all the image assets under data/ relative to the hs-files):
module Paths_nehe_tuts where
getDataFileName :: FilePath -> IO FilePath
getDataFileName fileName = return $ "data/" ++ fileName
I have to admit, I haven't built the examples in a while or with the new sandbox features in cabal.
Cabal used to generate that module automatically. Are you saying it no longer gets created or that you made it yourself to avoid having cabal do it?
I didn't get past the "runhaskell Setup configure" part, because it complained about missing depencies (GLFW-b >= 1.0.0). I'm not sure why, because I have 1.4.6 installed. So I did compile it manually, which works fine after generating the Paths-file.