module AoC ( getDataFileName ) where
import System.Environment
+import Data.Char
getDataFileName :: IO String
getDataFileName =
do args <- getArgs
progName <- getProgName
+ let progName' = reverse $ dropWhile isLetter $ reverse progName
let baseDataName = if null args
- then progName
+ then progName'
else head args
let baseDataName' = if length baseDataName < 5
- then progName ++ baseDataName
+ then progName' ++ baseDataName
else baseDataName
let dataFileName = "../data/" ++ baseDataName' ++ ".txt"
return dataFileName