1--------------------------------------------------------------------------------
2-- | A module containing various file utility functions
3module Hakyll.Core.Util.File
10--------------------------------------------------------------------------------
11import Control.Applicative ((<$>))
12import Control.Monad (forM, when)
13import System.Directory (createDirectoryIfMissing,
14 doesDirectoryExist, getDirectoryContents,
15 removeDirectoryRecursive)
16import System.FilePath (takeDirectory, (</>))
19--------------------------------------------------------------------------------
20-- | Given a path to a file, try to make the path writable by making
21-- all directories on the path.
22makeDirectories :: FilePath -> IO ()
23makeDirectories = createDirectoryIfMissing True . takeDirectory
26--------------------------------------------------------------------------------
27-- | Get all contents of a directory.
28getRecursiveContents :: FilePath -- ^ Directory to search
29 -> IO [FilePath] -- ^ List of files found
30getRecursiveContents top = go ""
32 isProper = (`notElem` [".", ".."])
34 dirExists <- doesDirectoryExist (top </> dir)
38 names <- filter isProper <$> getDirectoryContents (top </> dir)
39 paths <- forM names $ \name -> do
40 let rel = dir </> name
41 isDirectory <- doesDirectoryExist (top </> rel)
49--------------------------------------------------------------------------------
50removeDirectory :: FilePath -> IO ()
51removeDirectory fp = do
52 e <- doesDirectoryExist fp
53 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