I'm seeing something very bizarre in this piece of code.
command match {
case "q" | "quit" => done=true
case "f" | "file" =>
{
// console_reader.addCompleter(fn_completer)
val f:String=console_reader.readLine("input filename >")
val filename=
if(java.nio.file.Paths.get(f).isAbsolute())
f
else
System.getProperty("user.dir")+"/"+f
val ft=Paths.get(filename).toString()
console_reader.println(ft)
if(Files.exists(Paths.get(filename)))
process_file(filename)
else
console_reader.println(filename+" does not exist")
// console_reader.removeCompleter(fn_completer)
}
case _ => console_reader.println(command+" not a command")
}
when I run and type build.sbt everything is fine--process_file is called. When I uncomment the file completer lines, the same file is reported as not existing. What's up?
After reading the line, place console_reader.println(":"+f+":")
and it becomes apparent that with the completer and using tab completion, a space is appended to the filename.
I changed the line to val f=console_reader.readLine("input filename >").stripLineEnd.trim()
and that fixed things.