Update fileStream.hs
This commit is contained in:
parent
3f5e2861d8
commit
d994dceedd
1 changed files with 8 additions and 4 deletions
|
|
@ -1,7 +1,9 @@
|
|||
-- Copyright © 2025 Hashirama Senju
|
||||
{-
|
||||
this is an extremely fast and memory-constant program that lists directories in recursive mode;
|
||||
this is an extremely fast and memory-constant program that lists mdx files in directories in recursive mode;
|
||||
the output is utf8, so that it can display japanese characters.
|
||||
|
||||
notice that you can remove the filter and generalize this to search for any file that you want.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
|
@ -12,11 +14,13 @@ import Pipes.Safe
|
|||
import System.IO (stdout, hSetEncoding, utf8)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.IO as TIO
|
||||
import Filesystem.Path.CurrentOS (encodeString)
|
||||
import Filesystem.Path.CurrentOS (encodeString, extension)
|
||||
import Control.Monad (when)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
hSetEncoding stdout utf8
|
||||
runSafeT $ runEffect $
|
||||
for (every (descendentOf "/mnt/Data/Japanese_Resources/")) $
|
||||
liftIO . TIO.putStrLn . T.pack . encodeString
|
||||
for (every (descendentOf "/mnt/Data/Japanese_Resources/")) $ \fp ->
|
||||
when (extension fp == Just "mdx") $
|
||||
liftIO $ TIO.putStrLn $ T.pack $ encodeString fp
|
||||
|
|
|
|||
Loading…
Reference in a new issue