nehe-tuts icon indicating copy to clipboard operation
nehe-tuts copied to clipboard

Paths_nehe_tuts.hs gives broken absolute path

Open dagit opened this issue 13 years ago • 3 comments

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.

dagit avatar Nov 01 '11 20:11 dagit

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

jellehermsen avatar May 14 '14 13:05 jellehermsen

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?

dagit avatar May 14 '14 18:05 dagit

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.

jellehermsen avatar May 15 '14 08:05 jellehermsen