diff options
Diffstat (limited to 'src/Command/Extract.hs')
| -rw-r--r-- | src/Command/Extract.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Command/Extract.hs b/src/Command/Extract.hs index b21c63c..6828029 100644 --- a/src/Command/Extract.hs +++ b/src/Command/Extract.hs @@ -93,15 +93,11 @@ cmdExtract (ExtractCommand ExtractOptions {..} ExtractArguments {..}) = do True -> return () False -> tfail $ "artifact ‘" <> aname <> "’ of job ‘" <> textJobId jid <> "’ not found" - afile <- liftIO (listDirectory adir) >>= \case - [ file ] -> return file - [] -> tfail $ "artifact ‘" <> aname <> "’ of job ‘" <> textJobId jid <> "’ not found" - _:_:_ -> tfail $ "unexpected files in ‘" <> T.pack adir <> "’" - - let tpath | isdir = extractDestination </> afile + wpath <- liftIO $ readFile (adir </> "path") + let tpath | isdir = extractDestination </> takeFileName wpath | otherwise = extractDestination when (not extractForce) $ do liftIO (doesPathExist tpath) >>= \case True -> tfail $ "destination ‘" <> T.pack tpath <> "’ already exists" False -> return () - liftIO $ copyRecursiveForce (adir </> afile) tpath + liftIO $ copyRecursiveForce (adir </> "data") tpath |