Skip to content

Commit

Permalink
issue-161: Fix the case where a directory mapped does not have parent.
Browse files Browse the repository at this point in the history
It happens when one wants to map a directory from the root of the project.
In that case we use the `basic` mapper on the directory itself.
  • Loading branch information
ivanfrain committed Feb 17, 2014
1 parent 3314ab8 commit 3a5e044
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/com/typesafe/sbt/packager/MappingsHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ object MappingsHelper {

/** return a Seq of mappings which effect is to add a whole directory in the generated package */
def directory(sourceDir: File): Seq[(File, String)] = {
sourceDir.*** pair relativeTo(sourceDir.getParentFile)
val parentFile = sourceDir.getParentFile
if (parentFile != null)
sourceDir.*** pair relativeTo(sourceDir.getParentFile)
else
sourceDir.*** pair basic
}

/** It lightens the build file if one wants to give a string instead of file. */
Expand All @@ -26,6 +30,5 @@ object MappingsHelper {
def contentOf(sourceDir: String): Seq[(File, String)] = {
contentOf(file(sourceDir))
}

}

0 comments on commit 3a5e044

Please sign in to comment.