1--------------------------------------------------------------------------------
2-- | A module containing various file utility functions
3module Hakyll.Core.Util.File
10--------------------------------------------------------------------------------
11import Control.Monad (filterM, forM, when)
12import System.Directory (createDirectoryIfMissing,
13 doesDirectoryExist, getDirectoryContents,
14 removeDirectoryRecursive)
15import System.FilePath (takeDirectory, (</>))
18--------------------------------------------------------------------------------
19-- | Given a path to a file, try to make the path writable by making
20-- all directories on the path.
21makeDirectories :: FilePath -> IO ()
22makeDirectories = createDirectoryIfMissing True . takeDirectory
25--------------------------------------------------------------------------------
26-- | Get all contents of a directory.
27getRecursiveContents :: (FilePath -> IO Bool) -- ^ Ignore this file/directory
28 -> FilePath -- ^ Directory to search
29 -> IO [FilePath] -- ^ List of files found
30getRecursiveContents ignore top = go ""
33 | x `elem` [".", ".."] = return False
34 | otherwise = not <$> ignore x
37 dirExists <- doesDirectoryExist (top </> dir)
41 names <- filterM isProper =<< getDirectoryContents (top </> dir)
42 paths <- forM names $ \name -> do
43 let rel = dir </> name
44 isDirectory <- doesDirectoryExist (top </> rel)
52--------------------------------------------------------------------------------
53removeDirectory :: FilePath -> IO ()
54removeDirectory fp = do
55 e <- doesDirectoryExist fp
56 when e $ removeDirectoryRecursive fp
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list