Skip to content

Commit

Permalink
files: use relative path to target dir if only one was given
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Jul 13, 2019
1 parent 6543650 commit d45238f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Proteome/Files/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Proteome.Files.Source where
import Conduit (ConduitT, mapC, (.|))
import Control.Concurrent.Async.Lifted (async, wait)
import Data.Conduit.TMChan (TMChan, closeTMChan, newTMChan, sourceTMChan, writeTMChan)
import qualified Data.List.NonEmpty as NonEmpty (head)
import qualified Data.Text as Text (isPrefixOf)
import Path (Abs, Dir, File, Path, Rel, dirname, filename, stripProperPrefix, toFilePath)
import Path.IO (walkDir)
Expand Down Expand Up @@ -89,4 +90,8 @@ files conf cwd paths = do
sourceTMChan chan .| mapC (fmap menuItem)
where
menuItem path =
simpleMenuItem path (formatFileLine cwd path)
simpleMenuItem path (formatFileLine baseDir path)
baseDir =
if length paths == 1
then NonEmpty.head paths
else cwd

0 comments on commit d45238f

Please sign in to comment.