haskell / haskell/filepath

`System.FilePath.Posix` treats filenames with leading `.`s as extensions

Open
#259 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
74
Forks
38
PR merge metrics
No merged PRs in 30d

Description

Right now `System.FilePath.Posix.splitExtension` will treat any leading `.` in a path as an extension. This leads to some odd behaviour:

```haskell
import System.FilePath.Posix

splitExtension "myrepo/.git"
-- returns ("myrepo/", ".git")

splitExtension "myrepo/.."
-- returns ("myrepo/.",".")
```

I'd expect for `splitExtension` to treat a file whose leading character is a `.` as a filename. This appears to be consistent across all functions that work on paths (`takeBaseName`, etc). Changing these would be a pretty big breaking change, but at the very least this should probably be mentioned in the docs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.