Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/pr/189'
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Feb 26, 2023
2 parents 21ba597 + 6a1c98d commit 1ba9496
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion System/FilePath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,16 @@ splitFileName_ fp
-- If bs' is empty, then s2 as the last character of dirSlash must be a path separator,
-- so we are in the middle of shared drive.
-- Otherwise, since s1 is a path separator, we might be in the middle of UNC path.
, null bs' || maybe False (null . snd) (readDriveUNC dirSlash)
, null bs' || maybe False isIncompleteUNC (readDriveUNC dirSlash)
= (fp, mempty)
| otherwise
= (dirSlash, file)
where
(dirSlash, file) = breakEnd isPathSeparator fp

isIncompleteUNC (pref, suff) = null suff && not (hasPenultimateColon pref)
hasPenultimateColon = maybe False (maybe False ((== _colon) . snd) . unsnoc . fst) . unsnoc

-- | Set the filename.
--
-- > replaceFileName "/directory/other.txt" "file.ext" == "/directory/file.ext"
Expand Down

0 comments on commit 1ba9496

Please sign in to comment.