diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-26 08:15:44 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-26 08:15:44 -0700 |
commit | 4f114f86a10e314e434b3bdf4d02ef52d508053e (patch) | |
tree | f856e1a629cf0c131d9ccbf28cac6c6529fb8423 | |
parent | cc593bd49bdffc94860fc9c2d5630ce91d81667a (diff) | |
download | sscan-4f114f86a10e314e434b3bdf4d02ef52d508053e.tar.gz |
implement beginScanSess
-rw-r--r-- | Main.hs | 12 | ||||
-rw-r--r-- | sscan.cabal | 1 | ||||
-rw-r--r-- | stack.yaml | 3 |
3 files changed, 13 insertions, 3 deletions
@@ -2,12 +2,15 @@ import Control.Concurrent (forkFinally) import Control.Monad (void) +import Control.Monad.IO.Class (liftIO) import Data.Monoid import qualified Data.Text as T import qualified Graphics.Vty as V import Lens.Micro ((&), (.~), (^.)) -import System.Directory (getHomeDirectory) +import System.Directory (getHomeDirectory, + getTemporaryDirectory) import System.FilePath ((</>)) +import System.IO.Temp (createTempDirectory) import Brick.AttrMap import Brick.Main @@ -90,7 +93,12 @@ handleESC st = ifScanSess st (continue st) beginScanSess :: St -> EventM () St -beginScanSess st = undefined +beginScanSess st = do + temp <- liftIO $ getTemporaryDirectory + >>= \tmpdir -> createTempDirectory tmpdir "sscan" + return $ st + & stScanningSession .~ (Just temp) + & stPageCount .~ (Just 0) abortScanSess :: St -> EventM () St abortScanSess st = undefined diff --git a/sscan.cabal b/sscan.cabal index ae19a1a..ecec4eb 100644 --- a/sscan.cabal +++ b/sscan.cabal @@ -25,5 +25,6 @@ executable sscan , microlens-th >= 0.4.1.1 , text >= 1.2.2.1 , vty >= 5.15 + , temporary >= 1.2 -- hs-source-dirs: default-language: Haskell2010 @@ -1,7 +1,8 @@ resolver: lts-8.2 packages: - '.' -extra-deps: [] +extra-deps: +- temporary-1.2.0.4 flags: {} extra-package-dbs: [] system-ghc: true |