2
這段Scala代碼:scala.io.Source沒有找到現有文件
val file = new File(".")
assert(file.exists == true)
assert(file.getAbsolutePath.length > 0)
println(scala.io.Source.fromFile(file).getLines)
拋出。這怎麼可能,我該如何解決它?
PS:這是在玩框架應用程序測試的上下文中。
好一點,但這樣做'新文件(「./ FileName.java」)'不能解決問題無論是:( – 2012-07-20 20:28:07
@PabloFernandez:你說'file.exists'是真的,但你仍然得到'FileNotFoundException'?怎麼樣調用'新的FileInputStream(文件)'? – 2012-07-20 20:36:33
抱歉,我的應用程序有另一個錯誤導致這個問題。你的回答是正確的 – 2012-07-23 12:53:32