move windows test suite workaround to relatedTemplate
This commit is contained in:
parent
29e6b98f8c
commit
0c0f4a20f4
2 changed files with 7 additions and 6 deletions
|
@ -5,8 +5,6 @@
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
|
|
||||||
module Annex.ReplaceFile (
|
module Annex.ReplaceFile (
|
||||||
replaceGitAnnexDirFile,
|
replaceGitAnnexDirFile,
|
||||||
replaceGitDirFile,
|
replaceGitDirFile,
|
||||||
|
@ -59,11 +57,7 @@ replaceFile createdirectory file action = replaceFile' createdirectory file (con
|
||||||
|
|
||||||
replaceFile' :: (RawFilePath -> Annex ()) -> RawFilePath -> (a -> Bool) -> (RawFilePath -> Annex a) -> Annex a
|
replaceFile' :: (RawFilePath -> Annex ()) -> RawFilePath -> (a -> Bool) -> (RawFilePath -> Annex a) -> Annex a
|
||||||
replaceFile' createdirectory file checkres action = withOtherTmp $ \othertmpdir -> do
|
replaceFile' createdirectory file checkres action = withOtherTmp $ \othertmpdir -> do
|
||||||
#ifndef mingw32_HOST_OS
|
|
||||||
let basetmp = relatedTemplate' (P.takeFileName file)
|
let basetmp = relatedTemplate' (P.takeFileName file)
|
||||||
#else
|
|
||||||
let basetmp = toRawFilePath "t"
|
|
||||||
#endif
|
|
||||||
withTmpDirIn (fromRawFilePath othertmpdir) (toOsPath basetmp) $ \tmpdir -> do
|
withTmpDirIn (fromRawFilePath othertmpdir) (toOsPath basetmp) $ \tmpdir -> do
|
||||||
let tmpfile = toRawFilePath tmpdir P.</> basetmp
|
let tmpfile = toRawFilePath tmpdir P.</> basetmp
|
||||||
r <- action tmpfile
|
r <- action tmpfile
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
||||||
|
|
||||||
module Utility.Tmp (
|
module Utility.Tmp (
|
||||||
|
@ -111,6 +112,7 @@ relatedTemplate :: RawFilePath -> Template
|
||||||
relatedTemplate = toOsPath . relatedTemplate'
|
relatedTemplate = toOsPath . relatedTemplate'
|
||||||
|
|
||||||
relatedTemplate' :: RawFilePath -> RawFilePath
|
relatedTemplate' :: RawFilePath -> RawFilePath
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
relatedTemplate' f
|
relatedTemplate' f
|
||||||
| len > templateAddedLength =
|
| len > templateAddedLength =
|
||||||
{- Some filesystems like FAT have issues with filenames
|
{- Some filesystems like FAT have issues with filenames
|
||||||
|
@ -122,6 +124,11 @@ relatedTemplate' f
|
||||||
where
|
where
|
||||||
len = B.length f
|
len = B.length f
|
||||||
dot = fromIntegral (ord '.')
|
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
|
{- 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.
|
- 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