• thomie's avatar
    Bug fix: equalFilePath "C:\\" "C:" == False · bdc0446d
    thomie authored
    This started out as a simple refactoring of `equalFilePath`, and later turned
    out to also fix a small bug.
    The refactoring is: use `dropTrailingPathSeparator` instead of the custom
    function `dropTrailSlash`.
    A difference between these two functions is that `dropTrailingPathSeparator`
    potentially removes multiple trailing slashes, whereas `dropTrailSlash` only
    removes the last one. But since we `normalise` the FilePath first, which
    removes superfluous pathSeparators, this difference does not matter to us.
    Another difference is that `dropTrailingPathSeparator` does not drop slashes
    when the FilePath isDrive, but `dropTrailSlash` does:
    dropTrailSlash "C:\\" == "C:"
    dropTrailSlash "C:\\\\" == "C:\\"
    dropTrailingPathSeparator "C:\\" == "C:\\"
    dropTrailingPathSeparator "C:\\\\" == "C:\\\\"
    As a result, equalFilePath of drives on Windows changes slightly:
    equalFilePath "C:\\" "C:" == True
    equalFilePath "C:\\\\" "C:" == False
    equalFilePath "C:\\" "C:" == False
    equalFilePath "C:\\\\" "C:" == False
    This can be considered a bug fix, since "C:\\foo" and "C:foo", and thus "C:\\"
    and "C:", are not the same thing.
To find the state of this project's repository at the time of any of these versions, check out the tags.
changelog.md 681 Bytes