Reputation: 717
I've made a library, and I'm not using cabal for it (yet), so it's just as a folder next to main.hs source and stuff. When I put in one of my folders to use "Shaders/lt.frag" or even "Shaders" "lt.frag", I get a openBinaryFile error, because there's no "Shaders/lt.frag" at the top level.
So it's look at "./Shaders/lt.frag", instead of "./Graphics/Lib/Rendering/Shaders/lt.frag". Any way to solve that? The file that references it is in "./Graphics/Lib/Rendering", so it should be relative to that.
Upvotes: 0
Views: 80
Reputation: 19637
If you're opening a file from within a Haskell program, then where the OS is looking for the file depends on the working directory of the program. Typically, the working directory of the program is the directory from which you invoke the executable, or the directory in which you execute GHCi.
The working directory has absolutely nothing to do with the directories where the individual Haskell source files reside.
Cabal indeed gives you a way to place program data files into a particular location and get access to (the path of) that data directory while running the program.
Upvotes: 4