Added a comment: further info 3
This commit is contained in:
parent
a380b26d09
commit
e5b0ba4d0b
1 changed files with 38 additions and 0 deletions
|
@ -0,0 +1,38 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="https://www.google.com/accounts/o8/id?id=AItOawk5aY0oBmuQtnoTNtji-dPgDw9p7J24YeY"
|
||||||
|
nickname="Jiří"
|
||||||
|
subject="further info 3"
|
||||||
|
date="2014-03-19T16:23:58Z"
|
||||||
|
content="""
|
||||||
|
Also ghc doesn't seem to do any weird transformations with that string
|
||||||
|
|
||||||
|
import System.Process
|
||||||
|
import qualified Data.ByteString as S
|
||||||
|
import qualified Data.ByteString.UTF8 as U
|
||||||
|
import GHC.IO.Handle
|
||||||
|
|
||||||
|
files :: S.ByteString -> [S.ByteString]
|
||||||
|
files ps
|
||||||
|
| S.null ps = []
|
||||||
|
| otherwise = case search ps of
|
||||||
|
Nothing -> [ps]
|
||||||
|
Just n -> S.take n ps : files (S.drop (n+1) ps)
|
||||||
|
where search = S.elemIndex 0
|
||||||
|
|
||||||
|
main = do
|
||||||
|
let prc = CreateProcess {
|
||||||
|
cmdspec = RawCommand \"git\" [\"--work-tree=D:\\antest\",\"ls-files\",\"--others\",\"-z\",\"--\",\"h\225\269ky.txt\"],
|
||||||
|
cwd = Nothing,
|
||||||
|
env = Nothing,
|
||||||
|
std_in = Inherit,
|
||||||
|
std_out = CreatePipe,
|
||||||
|
std_err = Inherit,
|
||||||
|
close_fds = False,
|
||||||
|
create_group = False }
|
||||||
|
(_,Just out,_,_) <- createProcess prc
|
||||||
|
hSetBinaryMode out True
|
||||||
|
str <- S.hGetContents out
|
||||||
|
print $ map U.toString $ files str
|
||||||
|
|
||||||
|
prints correctly [\"h\225\269ky.txt\"] I don't think that FilesystemEncoding will do any good on windows, since git seems to use utf-8 instead of normal windows console encoding.
|
||||||
|
"""]]
|
Loading…
Reference in a new issue