Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update SparkContext.scala
  • Loading branch information
pzzs committed Mar 12, 2015
commit dced8ebee4832ee7c26167f08b412a49b84fbee9
3 changes: 1 addition & 2 deletions core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1092,9 +1092,8 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
*/
def addFile(path: String, recursive: Boolean): Unit = {
val uri = new URI(path)
val file = new File(path)
val schemeCorrectedPath = uri.getScheme match {
case null | "local" => "file:" + file.getCanonicalPath
case null | "local" => "file:" + new File(path).getCanonicalPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be slightly more robust as new File(path).getCanonicalFile.toURI.toString. Then the "file:" can go away too.

case _ => path
}

Expand Down