aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris2015-08-30 21:39:25 +0200
committerJoris2015-08-30 21:39:25 +0200
commit779e58b150aacd2d4eb50a7ec761bb9454499b6f (patch)
tree3c355d823013d96f5eb0072330e63a829ee7a9a8 /src
parent5ca62f8fffce22944119b684c1cbb0ca476eecf5 (diff)
Generate csv files in the output directory
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index cf557a0..f758ef7 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -7,6 +7,7 @@ module Main
import HTTP
import System.Environment (getArgs, getProgName)
+import System.Directory (createDirectory)
import Data.List (intercalate)
import Data.Text (Text)
@@ -35,8 +36,12 @@ main = do
T.putStrLn error
Right perfumesSequences ->
let commonPerfumes = getCommonPerfumes perfumesSequences
- outputName = (intercalate "-" materials) ++ ".csv"
- in T.writeFile outputName (csvPerfumes commonPerfumes)
+ outputDirectory = "output"
+ outputName = outputDirectory ++ "/" ++ (intercalate "-" materials) ++ ".csv"
+ in do
+ createDirectory outputDirectory
+ T.writeFile outputName (csvPerfumes commonPerfumes)
+ putStrLn ("Successfully generated " ++ outputName)
getHtmlPerfumes :: Text -> IO (Either Text [Perfume])
getHtmlPerfumes material = do