Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/853#discussion_r12999133
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1166,4 +1166,42 @@ private[spark] object Utils extends Logging {
             true
         }
       }
    +
    +  /**
    +   * Return a well-formed URI for the file described by a user input 
string.
    +   *
    +   * If the supplied path does not contain a scheme, or is a relative 
path, it will be
    +   * converted into an absolute path with a file:// scheme.
    +   */
    +  def resolveURI(path: String, testWindows: Boolean = false): URI = {
    +
    +    val windows = isWindows || testWindows
    +    // In Windows, the file separator is a backslash, but this is 
inconsistent with the URI format
    +    val formattedPath = if (windows) path.replace("\\", "/") else path
    +    // Each Windows drive contains only a single alphabet character
    +    val windowsDrive = "([a-zA-Z])".r
    +
    +    val uri = new URI(formattedPath)
    +    uri.getScheme match {
    +      case windowsDrive(d) if windows =>
    +        new URI("file:/" + uri.toString.stripPrefix("/"))
    --- End diff --
    
    I am a little confused with this. This function will convert window's path 
like `c:\hello\world.txt` to `file:/c:/hello/world.txt` . So the backslashes 
get permanently replaced by front slashes. How does resolving paths in window 
work after that?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to