more OsPath conversion

Sponsored-by: Eve
This commit is contained in:
Joey Hess 2025-01-24 14:49:10 -04:00
parent dd01406018
commit aa0f3f31da
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
23 changed files with 155 additions and 166 deletions

View file

@ -90,12 +90,12 @@ quotedPaths (p:ps) = QuotedPath p <> if null ps
instance Quoteable StringContainingQuotedPath where
quote _ (UnquotedString s) = safeOutput (encodeBS s)
quote _ (UnquotedByteString s) = safeOutput s
quote qp (QuotedPath p) = quote qp p
quote qp (QuotedPath p) = quote qp (fromOsPath p :: RawFilePath)
quote qp (a :+: b) = quote qp a <> quote qp b
noquote (UnquotedString s) = encodeBS s
noquote (UnquotedByteString s) = s
noquote (QuotedPath p) = p
noquote (QuotedPath p) = fromOsPath p
noquote (a :+: b) = noquote a <> noquote b
instance IsString StringContainingQuotedPath where
@ -117,6 +117,6 @@ instance Monoid StringContainingQuotedPath where
-- limits what's tested to ascii, so avoids running into it.
prop_quote_unquote_roundtrip :: TestableFilePath -> Bool
prop_quote_unquote_roundtrip ts =
s == fromOsPath (unquote (quoteAlways (toOsPath s)))
s == fromRawFilePath (unquote (quoteAlways (toRawFilePath s)))
where
s = fromTestableFilePath ts