#2709: System.Directory.doesDirectoryExist "\\" is False on Windows
------------------------------------+---------------------------------------
    Reporter:  Deewiant             |        Owner:  igloo  
        Type:  bug                  |       Status:  new    
    Priority:  high                 |    Milestone:  6.10.2 
   Component:  libraries/directory  |      Version:  6.10.1 
    Severity:  normal               |   Resolution:         
    Keywords:                       |   Difficulty:  Unknown
    Testcase:                       |           Os:  Windows
Architecture:  Unknown/Multiple     |  
------------------------------------+---------------------------------------
Changes (by igloo):

 * cc: [email protected] (added)

Comment:

 I think treating "\\" as not a drive is probably the right behaviour, so a
 patch along these lines should be applied to
 `System/FilePath/Internal.hs`; Neil, does that sound good to you?
 {{{
  -- > dropTrailingPathSeparator "file/test/" == "file/test"
  -- > not (hasTrailingPathSeparator (dropTrailingPathSeparator x)) ||
 isDrive x
  -- > Posix:    dropTrailingPathSeparator "/" == "/"
 +-- > Windows:  dropTrailingPathSeparator "\\" == "\\"
  dropTrailingPathSeparator :: FilePath -> FilePath
  dropTrailingPathSeparator x =
      if hasTrailingPathSeparator x && not (isDrive x)
 -    then reverse $ dropWhile isPathSeparator $ reverse x
 +    then let x' = reverse $ dropWhile isPathSeparator $ reverse x
 +         in if null x' then [pathSeparator] else x'
      else x
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2709#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to