Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose TarPath -> PosixString #98

Open
Bodigrim opened this issue Sep 6, 2024 · 0 comments
Open

Expose TarPath -> PosixString #98

Bodigrim opened this issue Sep 6, 2024 · 0 comments

Comments

@Bodigrim
Copy link
Contributor

Bodigrim commented Sep 6, 2024

Essentially this, but with a better name:

fromTarPathInternal :: PosixChar -> TarPath -> PosixString
fromTarPathInternal sep = go
where
posixSep = PS.unsafeFromChar FilePath.Posix.pathSeparator
adjustSeps = if sep == posixSep then id else
PS.map $ \c -> if c == posixSep then sep else c
go (TarPath name prefix)
| PS.null prefix = adjustSeps name
| PS.null name = adjustSeps prefix
| otherwise = adjustSeps prefix <> PS.cons sep (adjustSeps name)

Or maybe just expose data TarPath from somewhere?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant