Commit f9f21869 authored by Kenny Kaye's avatar Kenny Kaye

File paths are handled by File constructor

parent 3af6aaf2
...@@ -55,24 +55,20 @@ private object IdlParser extends RegexParsers { ...@@ -55,24 +55,20 @@ private object IdlParser extends RegexParsers {
var file: Option[File] = None var file: Option[File] = None
val path = includePaths.find(path => { val path = includePaths.find(path => {
val relPath = if (path.isEmpty) fileParent else path + "/" val relPath = if (path.isEmpty) fileStack.top.getParent() else path
val tmp = new File(relPath + fileName) val tmp = new File(relPath, fileName)
val exists = tmp.exists val exists = tmp.exists
if (exists) file = Some(tmp) if (exists) file = Some(tmp)
exists exists
}) })
if (path.isEmpty || file.isEmpty) throw new FileNotFoundException("Unable to find file \"" + fileName + "\" at " + fileStack.top.getCanonicalPath) if (file.isEmpty) throw new FileNotFoundException("Unable to find file \"" + fileName + "\" at " + fileStack.top.getCanonicalPath)
return file.get return file.get
} }
def filePath = "[^\"]*".r def filePath = "[^\"]*".r
def fileParent(): String = {
if (fileStack.top.getParent() != null) fileStack.top.getParent() + "/" else ""
}
def directive = importDirective | externDirective def directive = importDirective | externDirective
def importDirective = "import".r def importDirective = "import".r
def externDirective = "extern".r def externDirective = "extern".r
......
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