shared files / environment / portability

I'm coding a resource tracker for a game that loads images, sounds, etc. from files, and wondering how the program will know where the files are located on the installation system. (With C/C++ programs I usually had the build system hardcode the appropriate share/ directory into the config.h file.) Assuming I package for cabal distribution, what approaches to this problem are available to me? (P.S. Thanks for the answer to the previous question about associative arrays.) -- frigidcode.com indicium.us

On Sat, Aug 25, 2012 at 8:09 AM, Christopher Howard < christopher.howard@frigidcode.com> wrote:
I'm coding a resource tracker for a game that loads images, sounds, etc. from files, and wondering how the program will know where the files are located on the installation system. (With C/C++ programs I usually had the build system hardcode the appropriate share/ directory into the config.h file.) Assuming I package for cabal distribution, what approaches to this problem are available to me?
(P.S. Thanks for the answer to the previous question about associative arrays.)
Cabal includes a slightly limited system for that : http://www.haskell.org/ghc/docs/7.0.2/html/Cabal/authors.html#paths-module http://neilmitchell.blogspot.fr/2008/02/adding-data-files-using-cabal.html -- Jedaï

On Sat, 25 Aug 2012 08:09:04 +0200, Christopher Howard
I'm coding a resource tracker for a game that loads images, sounds, etc. from files, and wondering how the program will know where the files are located on the installation system. (With C/C++ programs I usually had the build system hardcode the appropriate share/ directory into the config.h file.) Assuming I package for cabal distribution, what approaches to this problem are available to me?
You can find an example in wxAsteroids[0], look at the main function. Met vriendelijke groet, Henk-Jan van Tuyl [0] http://hackage.haskell.org/package/wxAsteroids -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --

On Sat, 25 Aug 2012 10:08:01 +0200, Henk-Jan van Tuyl
On Sat, 25 Aug 2012 08:09:04 +0200, Christopher Howard
wrote: I'm coding a resource tracker for a game that loads images, sounds, etc. from files, and wondering how the program will know where the files are located on the installation system. (With C/C++ programs I usually had the build system hardcode the appropriate share/ directory into the config.h file.) Assuming I package for cabal distribution, what approaches to this problem are available to me?
You can find an example in wxAsteroids[0], look at the main function.
Another example can be found in the FRP version of wxAsteroids[1], e.g.: rock = bitmap $ getDataFile "rock.ico" Regards, Henk-Jan van Tuyl [1] https://github.com/HeinrichApfelmus/reactive-banana/blob/master/reactive-ban... -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --
participants (3)
-
Chaddaï Fouché
-
Christopher Howard
-
Henk-Jan van Tuyl