1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module CPC.Files
  (cpcSubdir, inCpcSubdir, addCpcSubdir, addInstSuffix, hasInstSuffix )
 where

import FilePath ((</>), splitFileName )
import List     (isSuffixOf)

--- Rename a program into an instrumented program:
addInstSuffix :: String -> String
addInstSuffix mn = mn ++ "_Instrumented"

--- Is a program name the name of an instrumented program?
hasInstSuffix :: String -> Bool
hasInstSuffix mn = "_Instrumented" `isSuffixOf` mn

cpcSubdir :: String
cpcSubdir = ".cpc"

inCpcSubdir :: String -> String
inCpcSubdir fn = let (path, file) = splitFileName fn
                 in addCpcSubdir path </> file

addCpcSubdir :: String -> String
addCpcSubdir dir = dir </> cpcSubdir