如何使用Rapture IO删除Windows上的文件

如何使用Rapture IO删除Windows上的文件,windows,scala,rapture.io,Windows,Scala,Rapture.io,我正在写Scala代码。在Windows上使用Rapture操作文件时,写入URI的正确路径模式是什么?我添加了以下依赖项: libraryDependencies += "com.propensive" %% "rapture" % "2.0.0-M3" exclude("com.propensive","rapture-json-lift_2.11") 以下是我的部分代码: import rapture.uri._ import rapture.io._ val file = uri"fi

我正在写Scala代码。在Windows上使用Rapture操作文件时,写入URI的正确路径模式是什么?我添加了以下依赖项:

libraryDependencies += "com.propensive" %% "rapture" % "2.0.0-M3" exclude("com.propensive","rapture-json-lift_2.11")
以下是我的部分代码:

import rapture.uri._
import rapture.io._
val file = uri"file:///C:/opt/eric/spark-demo"
file.delete()
但我得到了信息:

Error:(17, 16) value file is not a member of object rapture.uri.UriContext
val file = uri"file:///C:/opt/eric/spark-demo"
或者我试过这个:

val file = uri"file://opt/eric/spark-demo"
同样的错误:

Error:(17, 16) value file is not a member of object rapture.uri.UriContext
val file = uri"file://opt/eric/spark-demo"
我的本地路径是:

C:\opt\eric\spark-demo

如何避免此错误?

您缺少导入:

import rapture.io._
import rapture.uri._
import rapture.fs._

val file = uri"file:///C:/opt/eric/spark-demo"
file.delete()

rapture.fs
是定义
EnrichedFileUriContext
隐式类的包,当提供
文件
uri方案时,uri宏尝试构建该类。

缺少导入:

import rapture.io._
import rapture.uri._
import rapture.fs._

val file = uri"file:///C:/opt/eric/spark-demo"
file.delete()
rapture.fs
是定义
EnrichedFileUriContext
隐式类的包,当提供
文件
uri方案时,uri宏尝试构建该类