projects
/
advent-of-code-24.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1b58223
)
Smarter filename handling for AoC library
main
author
Neil Smith
<NeilNjae@users.noreply.github.com>
Wed, 8 Jan 2025 13:21:01 +0000
(13:21 +0000)
committer
Neil Smith
<NeilNjae@users.noreply.github.com>
Wed, 8 Jan 2025 13:21:01 +0000
(13:21 +0000)
src/AoC.hs
patch
|
blob
|
history
diff --git
a/src/AoC.hs
b/src/AoC.hs
index 90b5c62b18f58c8e9fde85044090d99d0ac4e6d8..b3773a4ed4ebfe914caa445e0a9ee094721aa798 100644
(file)
--- a/
src/AoC.hs
+++ b/
src/AoC.hs
@@
-1,16
+1,18
@@
module AoC ( getDataFileName ) where
import System.Environment
module AoC ( getDataFileName ) where
import System.Environment
+import Data.Char
getDataFileName :: IO String
getDataFileName =
do args <- getArgs
progName <- getProgName
getDataFileName :: IO String
getDataFileName =
do args <- getArgs
progName <- getProgName
+ let progName' = reverse $ dropWhile isLetter $ reverse progName
let baseDataName = if null args
let baseDataName = if null args
- then progName
+ then progName
'
else head args
let baseDataName' = if length baseDataName < 5
else head args
let baseDataName' = if length baseDataName < 5
- then progName ++ baseDataName
+ then progName
'
++ baseDataName
else baseDataName
let dataFileName = "../data/" ++ baseDataName' ++ ".txt"
return dataFileName
else baseDataName
let dataFileName = "../data/" ++ baseDataName' ++ ".txt"
return dataFileName