Commit 512f3dc1 authored by Kenny Kaye's avatar Kenny Kaye

Finish searching for import files after one is found in the include path

parent a8c89710
...@@ -26,6 +26,7 @@ import java.util.{Map => JMap} ...@@ -26,6 +26,7 @@ import java.util.{Map => JMap}
import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.Yaml
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
import scala.collection.mutable import scala.collection.mutable
import scala.util.control.Breaks._
import scala.util.parsing.combinator.RegexParsers import scala.util.parsing.combinator.RegexParsers
import scala.util.parsing.input.{Position, Positional} import scala.util.parsing.input.{Position, Positional}
...@@ -53,16 +54,15 @@ private object IdlParser extends RegexParsers { ...@@ -53,16 +54,15 @@ private object IdlParser extends RegexParsers {
def importFile(fileName: String): File = { def importFile(fileName: String): File = {
var file: Option[File] = None var file: Option[File] = None
includePaths.foreach(path => { val path = includePaths.find(path => {
if (file.isEmpty) { val relPath = if (path.isEmpty) fileParent else path + "/"
var relPath = if (path.isEmpty) fileParent else path + "/" val tmp = new File(relPath + fileName)
val tmp = new File(relPath + fileName); val exists = tmp.exists
if (tmp.exists) if (exists) file = Some(tmp)
file = Some(tmp) exists
}
}) })
if (file.isEmpty) throw new FileNotFoundException("Unable to find file \"" + fileName + "\" at " + fileStack.top.getCanonicalPath) if (path.isEmpty || file.isEmpty) throw new FileNotFoundException("Unable to find file \"" + fileName + "\" at " + fileStack.top.getCanonicalPath)
return file.get return file.get
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment