From 258400ddb36554c391c56667543512fca5458447 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 27 Aug 2016 13:11:14 +0200 Subject: [PATCH] creating directories if neccessary --- Handler/Upload.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Handler/Upload.hs b/Handler/Upload.hs index 3840d72..e127791 100755 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -193,6 +193,12 @@ writeOnDrive fil userId albumId = do let filen = show $ length (albumContent album) + 1 let ext = FP.takeExtension $ T.unpack $ fileName fil let path = "static" FP. "data" FP. T.unpack (extractKey userId) FP. T.unpack (extractKey albumId) FP. filen ++ ext + dde <- liftIO $ doesDirectoryExist $ FP.dropFileName path + if not dde + then + liftIO $ createDirectoryIfMissing True $ FP.dropFileName path + else + return () liftIO $ fileMove fil path return path