Skip to content


Data-Files cabal directive should support directories #713

bos opened this Issue · 9 comments

6 participants

Haskell member

(Imported from Trac #722, reported by cygnus on 2010-08-02)

It should be possible to use the Data-Files directive to include whole directories (recursively) in source distributions. In many cases it's impossible or cumbersome to list all of the files one would like to install, and it seems to me that nobody should have to do that if what they really mean is, "install everything in that-data-dir/."

In implementation terms, this doesn't strike me as too tricky; after the wildcard parsing that already happens, detect whether the files to be copied are in fact directories and copy them recursively as such.

I'm more than willing to hack on this.

Haskell member

(Imported comment by @dcoutts on 2010-08-02)

I think we should discuss this with users a bit first. The point of the existing rather limited support for globbing is to avoid accidentally picking up more files than was intended (e.g. hidden or generated files). By limiting it to files with a common extension this risk is greatly reduced. Perhaps we could make it explicit by only doing recursive copy for directories that are listed in the data-files field with a trailing directory slash, e.g. data-files: graphics/

Haskell member

(Imported comment by @ezyang on 2010-08-09)

I will note, for whatever it's worth, that this design policy has lead me to write scripts that do regular style globbing and convert it into something I can place in my Cabal file. :-)

Haskell member

(Imported comment by cygnus on 2010-08-09)

I would support a trailing slash option.

Haskell member

(Imported comment by @dcoutts on 2010-08-10)

See also #794.


I think the issue IDs were rearranged -- #794 doesn't seem to be relevant to this issue. #784 is, however.

Haskell member

@hdgarrood Yes, @dcoutts refers to . Cross-references got mixed up during the trac -> github import.

@hdgarrood hdgarrood added a commit to hdgarrood/cabal that referenced this issue
@hdgarrood hdgarrood Allow directories in cabal data-files (#713)
This commit adds the capability to specify a whole directory which
contains data-files in a project's .cabal file.

If a data-files entry ends with a slash, like "static/", then it will
pull in all files under the directory named "static/".


* This has only been tested by calling matchDirFileGlob in GHCi.
* I'm not sure about the name (data FileGlob = DirTrailingSlash --
  perhaps it should have Glob on the end like the others?) but I've been
  unable to come up with anything better.
@23Skidoo 23Skidoo modified the milestone: Cabal-1.22, Cabal-1.18

Having data-files: static/*.foo not glob static/* is rather surprising. A documented gotcha is still a gotcha.

I would support using a standard globbing mechanism in place of the current one, which also seems to have some odd corner cases. (#2030)


Halcyon supports declaring additional data-files for use at run-time with the HALCYON_EXTRA_DATA_FILES option, using standard GNU bash globbing syntax.

See Haskell Language for an example of declaring static website content as data files.

@mietek mietek referenced this issue in mietek/halcyon

Add and improve glob-based options #39

0 of 2 tasks complete
@ttuegel ttuegel modified the milestone: Cabal-1.24, Cabal-1.22

Tihs is either superceded by (or supercedes) #784 . Can we please close one of them?

EDIT: Actually, it's superceded. Glob syntax allows for directories (recursively) via "foo/*/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.