Merge branch 'master' into ospath
This commit is contained in:
commit
9394197621
4 changed files with 31 additions and 5 deletions
|
@ -157,10 +157,13 @@ truncateFilePath n = toRawFilePath . reverse . go [] n
|
|||
go coll cnt bs
|
||||
| cnt <= 0 = coll
|
||||
| otherwise = case S8.decode bs of
|
||||
Just (c, x) | c /= S8.replacement_char ->
|
||||
let x' = fromIntegral x
|
||||
in if cnt - x' < 0
|
||||
then coll
|
||||
else go (c:coll) (cnt - x') (S8.drop 1 bs)
|
||||
Just (c, x)
|
||||
| c /= S8.replacement_char ->
|
||||
let x' = fromIntegral x
|
||||
in if cnt - x' < 0
|
||||
then coll
|
||||
else go (c:coll) (cnt - x') (S8.drop 1 bs)
|
||||
| otherwise ->
|
||||
go ('_':coll) (cnt - 1) (S8.drop 1 bs)
|
||||
_ -> coll
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||
|
||||
module Utility.Tmp (
|
||||
|
@ -110,6 +111,7 @@ relatedTemplate :: RawFilePath -> Template
|
|||
relatedTemplate = toOsPath . relatedTemplate'
|
||||
|
||||
relatedTemplate' :: RawFilePath -> RawFilePath
|
||||
#ifndef mingw32_HOST_OS
|
||||
relatedTemplate' f
|
||||
| len > templateAddedLength =
|
||||
{- Some filesystems like FAT have issues with filenames
|
||||
|
@ -121,6 +123,11 @@ relatedTemplate' f
|
|||
where
|
||||
len = B.length f
|
||||
dot = fromIntegral (ord '.')
|
||||
#else
|
||||
-- Avoids a test suite failure on windows, reason unknown, but
|
||||
-- best to keep paths short on windows anyway.
|
||||
relatedTemplate' _ = "t"
|
||||
#endif
|
||||
|
||||
{- When a Template is used to create a temporary file, some random bytes
|
||||
- are appended to it. This is how many such bytes can be added, maximum.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue