aboutsummaryrefslogtreecommitdiff
path: root/Messages.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-02-11 15:37:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-02-11 15:37:37 -0400
commit5a50a7cf137997a9d940b9a89a0968452a1ac411 (patch)
tree64ac76dc4a4327a2b3eafbee28c45670af71340f /Messages.hs
parent285fb2bb08c7da534c111ebfeee5911e850570cc (diff)
update unicode FilePath handling
Based on http://hackage.haskell.org/trac/ghc/ticket/3307 , whether FilePath contains decoded unicode varies by OS. So, add a configure check for it. Also, renamed showFile to filePathToString
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Messages.hs b/Messages.hs
index ab5992a6c..80b53e5cd 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -11,10 +11,11 @@ import Control.Monad.State (liftIO)
import System.IO
import Control.Monad (unless)
import Data.String.Utils
-import Codec.Binary.UTF8.String as UTF8
+import qualified Codec.Binary.UTF8.String as UTF8
import Types
import qualified Annex
+import SysConfig
verbose :: Annex () -> Annex ()
verbose a = do
@@ -26,7 +27,7 @@ showSideAction s = verbose $ liftIO $ putStrLn $ "(" ++ s ++ ")"
showStart :: String -> String -> Annex ()
showStart command file = verbose $ do
- liftIO $ putStr $ command ++ " " ++ showFile file ++ " "
+ liftIO $ putStr $ command ++ " " ++ filePathToString file ++ " "
liftIO $ hFlush stdout
showNote :: String -> Annex ()
@@ -58,7 +59,8 @@ warning w = do
indent :: String -> String
indent s = join "\n" $ map (\l -> " " ++ l) $ lines s
-{- Prepares a filename for display. This is needed because strings are
- - internally represented in git-annex is non-decoded form. -}
-showFile :: FilePath -> String
-showFile = decodeString
+{- Prepares a filename for display. This is needed because on many
+ - platforms (eg, unix), FilePaths are internally stored in
+ - non-decoded form. -}
+filePathToString :: FilePath -> String
+filePathToString = if unicodefilepath then id else UTF8.decodeString