move windows test suite workaround to relatedTemplate

This commit is contained in:
Joey Hess 2025-01-30 19:06:06 -04:00
parent 29e6b98f8c
commit 0c0f4a20f4
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 6 deletions

View file

@ -6,6 +6,7 @@
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.Tmp (
@ -111,6 +112,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
@ -122,6 +124,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.