1. Jimmy Yuen Ho Wong
  2. sbt-filter-plugin

Commits

Jimmy Yuen Ho Wong  committed 1fa25b6

fixed bug #1

  • Participants
  • Parent commits f26a517
  • Branches default

Comments (0)

Files changed (2)

File project/build.properties

View file
 project.organization=org.bitbucket
 project.name=sbt-filter-plugin
 sbt.version=0.7.4
-project.version=1.0
+project.version=1.0.1
 build.scala.versions=2.7.7
 project.initialize=false

File src/main/scala/SBTFilterPlugin.scala

View file
     }
 
     def substitute(prop: JProperties, f: File) = {
-      val buf = new StringWriter
-      val in = Source.fromFile(f)
-      in.getLines.foreach(l => {
-        var line = l
-        prop.propertyNames.foreach(key => {
-          line = line.replaceAll("\\$\\{\\s*" + key.toString + "\\s*\\}", prop.getProperty(key.toString))
+      if (f.isFile) {
+        val buf = new StringWriter
+        val in = Source.fromFile(f)
+        in.getLines.foreach(l => {
+          var line = l
+          prop.propertyNames.foreach(key => {
+            line = line.replaceAll("\\$\\{\\s*" + key.toString + "\\s*\\}", prop.getProperty(key.toString))
+          })
+          buf.write(line)
         })
-        buf.write(line)
-      })
 
-      val out = new PrintWriter(f)
-      out.print(buf.toString)
-      out.close()
+        val out = new PrintWriter(f)
+        out.print(buf.toString)
+        out.close()
+      }
     }
 
     val envPropertyFilesMap = HashMap[String, String]() ++ filterFilePaths.map(path => path.asFile.getName.split("\\.")(0) -> path.absolutePath)