I have a Scala application which processes binary files from some directory in resources
. I would like to get this directory as java.io.File
and list all the contents. In the newest sbt I am unable to do it the straight way.
I have created minimal repo with my issue:
https://github.com/mat646/sbt-resource-bug
The issue does not occur with sbt
0.13.18 and lower.
So after some research I've found out that since sbt
1.0 the design has changed and such issue has been already addressed here:
https://github.com/sbt/sbt/issues/3963
So the offered solutions were:
- downgrade to
sbt
0.13 (which I would like to avoid) - extracting project jar itself (which I found pretty nagging, as I still haven't solved it yet - the https://github.com/sbt/io contains
gunzip
method but for me it still fails to extract my directory from jar, but here I might be misunderstanding how to extract nested file from project jar)
(so as thesbt
1.0+ works on build jar for reading filesgetResourceAsStream
works perfectly but fails for my issue)