File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -668,23 +668,20 @@ splitFileName_ fp
668
668
= (dirSlash, file)
669
669
where
670
670
(dirSlash, file) = breakEnd isPathSeparator fp
671
- -- an adjustant variant of 'dropTrailingPathSeparator' that normalises trailing path separators
672
- -- on windows
673
- dropTrailingPathSeparator' x =
674
- if hasTrailingPathSeparator x
675
- then let x' = dropWhileEnd isPathSeparator x
676
- in if | null x' -> singleton (last x)
677
- | isDrive x -> addTrailingPathSeparator x'
678
- | otherwise -> x'
679
- else x
671
+ dropExcessTrailingPathSeparators x
672
+ | hasTrailingPathSeparator x
673
+ , let x' = dropWhileEnd isPathSeparator x
674
+ , otherwise = if | null x' -> singleton (last x)
675
+ | otherwise -> addTrailingPathSeparator x'
676
+ | otherwise = x
680
677
681
678
-- an "incomplete" UNC is one without a path (but potentially a drive)
682
679
isIncompleteUNC (pref, suff) = null suff && not (hasPenultimateColon pref)
683
680
684
681
-- e.g. @//?/a:/@ or @//?/a://@, but not @//?/a:@
685
682
hasPenultimateColon pref
686
683
| hasTrailingPathSeparator pref
687
- = maybe False (maybe False ((== _colon) . snd ) . unsnoc . fst ) . unsnoc . dropTrailingPathSeparator' $ pref
684
+ = maybe False (maybe False ((== _colon) . snd ) . unsnoc . fst ) . unsnoc . dropExcessTrailingPathSeparators $ pref
688
685
| otherwise = False
689
686
690
687
-- | Set the filename.
You can’t perform that action at this time.
0 commit comments