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 -> Bool) -- ^ Ignore this file/directory
29 -> FilePath -- ^ Directory to search
30 -> IO [FilePath] -- ^ List of files found
31getRecursiveContents ignore top = go ""
33 isProper x = notElem x [".", ".."] && not (ignore x)
35 dirExists <- doesDirectoryExist (top </> dir)
39 names <- filter isProper <$> getDirectoryContents (top </> dir)
40 paths <- forM names $ \name -> do
41 let rel = dir </> name
42 isDirectory <- doesDirectoryExist (top </> rel)
50--------------------------------------------------------------------------------
51removeDirectory :: FilePath -> IO ()
52removeDirectory fp = do
53 e <- doesDirectoryExist fp
54 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