Few questions

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Aug 12 12:14:38 EDT 2007


On Sun, 2007-08-12 at 18:15 +0300, Esa Ilari Vuokko wrote:

> > > * Are defaultMain-helpers supposed to turn relative paths from
> > >   commandline into absolute ones?  (I ran into this problem with Alex'
> > >   Setup.lhs, which changes working directory for copying files.)
> >
> > No idea. Can you be more specific?
> 
> Running following in alex source directory
> 
> setup copy --destdir=dist\cabal2wix
> 
> causes alex's setup hooks copy files in template\ directory to
> template\dist\cabal2wix\$datadir, because dist\cabal2wix is assumed
> to be absolute, and hook changes the working directory into template\.

Sounds like the hook should not change the working directory.

eg instead of:

install pkg_descr lbi copy_dest =
  excursion "templates" $ do
  let dataDir = mkDataDir pkg_descr lbi copy_dest
  createDirectoryIfMissing True dataDir
  sequence [ copyFile f (dataDir ++ '/':f) | (f,_) <- all_templates ]

it should stay in the same dir and just prefix "templates/":

install pkg_descr lbi copy_dest = do
  let dataDir = mkDataDir pkg_descr lbi copy_dest
  createDirectoryIfMissing True dataDir
  sequence [ copyFile ("templates" </> f) (dataDir </> f)
           | (f,_) <- all_templates ]


Duncan



More information about the cabal-devel mailing list