Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GNUmakefile
dist-install/
dist-newstyle/
dist-mcabal/
dist/
ghc.mk
.stack-work/
2 changes: 1 addition & 1 deletion System/FilePath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ import Data.List(stripPrefix, isSuffixOf, uncons, dropWhileEnd)
import Prelude (fromIntegral, return, IO, Either(..))
import Control.Exception ( catch, displayException, evaluate, fromException, toException, throwIO, Exception, SomeAsyncException(..), SomeException )
import Control.DeepSeq (force)
import GHC.IO (unsafePerformIO)
import System.IO.Unsafe (unsafePerformIO)
import qualified Data.Char as C
#ifdef WINDOWS
import GHC.IO.Encoding.Failure ( CodingFailureMode(..) )
Expand Down
9 changes: 9 additions & 0 deletions System/OsPath/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ import GHC.IO.Encoding.Failure ( CodingFailureMode(..) )
import System.OsString.Internal.Types
import System.OsPath.Encoding
import Control.Monad (when)
#if !defined(__MHS__)
import System.IO
( TextEncoding )
#else
import GHC.IO.Encoding.Types ( TextEncoding )
#endif

#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
import qualified System.OsPath.Windows as PF
Expand Down Expand Up @@ -124,6 +128,7 @@ fromBytes = OS.fromBytes



#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter)
-- | QuasiQuote an 'OsPath'. This accepts Unicode characters
-- and encodes as UTF-8 on unix and UTF-16LE on windows. Runs 'isValid'
-- on the input. If used as a pattern, requires turning on the @ViewPatterns@
Expand Down Expand Up @@ -159,6 +164,10 @@ osp = QuasiQuoter
fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)"
}
#endif
#else
osp :: a
osp = error "Systen.OsPath.Internal.ostr: no Template Haskell"
#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */


-- | Unpack an 'OsPath' to a list of 'OsChar'.
Expand Down
6 changes: 6 additions & 0 deletions System/OsPath/Posix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "Common.hs"

#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter)
-- | QuasiQuote a 'PosixPath'. This accepts Unicode characters
-- and encodes as UTF-8. Runs 'isValid' on the input.
pstr :: QuasiQuoter
Expand All @@ -29,3 +30,8 @@ pstr =
, quoteDec = \_ ->
fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)"
}
#else
pstr :: a
pstr = error "Systen.OsPath.Posix.pstr: no Template Haskell"
#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */

6 changes: 5 additions & 1 deletion System/OsPath/Windows.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "Common.hs"


#if defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter)
-- | QuasiQuote a 'WindowsPath'. This accepts Unicode characters
-- and encodes as UTF-16LE. Runs 'isValid' on the input.
pstr :: QuasiQuoter
Expand All @@ -30,3 +30,7 @@ pstr =
, quoteDec = \_ ->
fail "illegal QuasiQuote (allowed as expression or pattern only, used as a declaration)"
}
#else
pstr :: a
pstr = error "Systen.OsPath.Windows.pstr: no Template Haskell"
#endif /* defined(MIN_VERSION_template_haskell) || defined(MIN_VERSION_template_haskell_quasi_quoter) */
7 changes: 6 additions & 1 deletion filepath.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ library
, bytestring >=0.11.3.0
, deepseq
, exceptions
, template-haskell
, os-string >=2.0.1
if impl(ghc)
build-depends:
template-haskell
if impl(mhs)
build-depends:
ghc-compat

ghc-options: -Wall

Expand Down
Loading