@@ -74,6 +74,8 @@ import qualified System.FilePath.Windows as FilePath.Windows
74
74
import System.Posix.Types
75
75
( FileMode )
76
76
77
+ import Codec.Archive.Tar.PackAscii
78
+
77
79
type FileSize = Int64
78
80
-- | The number of seconds since the UNIX epoch
79
81
type EpochTime = Int64
@@ -357,14 +359,14 @@ splitLongPath :: FilePath -> Either String TarPath
357
359
splitLongPath path =
358
360
case packName nameMax (reverse (FilePath.Posix. splitPath path)) of
359
361
Left err -> Left err
360
- Right (name, [] ) -> Right $! TarPath (BS.Char8. pack name)
362
+ Right (name, [] ) -> Right $! TarPath (packAscii name)
361
363
BS. empty
362
364
Right (name, first: rest) -> case packName prefixMax remainder of
363
365
Left err -> Left err
364
366
Right (_ , (_: _)) -> Left $ " Filename " ++ path ++
365
367
" too long (cannot split)"
366
- Right (prefix, [] ) -> Right $! TarPath (BS.Char8. pack name)
367
- (BS.Char8. pack prefix)
368
+ Right (prefix, [] ) -> Right $! TarPath (packAscii name)
369
+ (packAscii prefix)
368
370
where
369
371
-- drop the '/' between the name and prefix:
370
372
remainder = init first : rest
@@ -399,7 +401,7 @@ instance NFData LinkTarget where
399
401
-- characters.
400
402
--
401
403
toLinkTarget :: FilePath -> Maybe LinkTarget
402
- toLinkTarget path | length path <= 100 = Just $! LinkTarget (BS.Char8. pack path)
404
+ toLinkTarget path | length path <= 100 = Just $! LinkTarget (packAscii path)
403
405
| otherwise = Nothing
404
406
405
407
-- | Convert a tar 'LinkTarget' to a native 'FilePath'.
0 commit comments