Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 21 lines (16 sloc) 0.554 kb
7d5975e @hiratara initial commit
authored
1 import System.FilePath (replaceExtension)
2 import System.Directory (doesFileExist, renameDirectory, renameFile)
3 import Glob (namesMatching)
4
5 renameWith :: (FilePath -> FilePath) -> FilePath -> IO FilePath
6 renameWith f path = do
7 let path' = f path
8 rename path path'
9 return path'
10
11 rename :: FilePath -> FilePath -> IO ()
12 rename old new = do
13 isFile <- doesFileExist old
14 let f = if isFile then renameFile else renameDirectory
15 f old new
16
17 cc2cpp :: IO [String]
18 cc2cpp =
19 mapM (renameWith (flip replaceExtension ".cpp")) =<< namesMatching "*.cc"
20
Something went wrong with that request. Please try again.