Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expect to be run at project root #69

Open
nomeata opened this issue Nov 15, 2020 · 1 comment
Open

Expect to be run at project root #69

nomeata opened this issue Nov 15, 2020 · 1 comment

Comments

@nomeata
Copy link

nomeata commented Nov 15, 2020

I hit this problem when trying to use the getPackageExtentions function pointing to a cabal file that is not my current directory, but I can also exhibit it using the CLI:

…/ext-stats $ extensions --cabal-file-path hackage/3dmodels-0.3.0/*.cabal 
  ⓘ Extensions for each module combined with 'default-extensions'
…/ext-stats $ cd hackage/3dmodels-0.3.0
…/hackage/3dmodels-0.3.0 $ extensions --cabal-file-path *.cabal
  ⓘ Extensions for each module combined with 'default-extensions'
Graphics/Model/DirectX.hs
    OverloadedStrings
    RecordWildCards
Graphics/Model/MikuMikuDance.hs
Graphics/Model/MikuMikuDance/Loader.hs
    OverloadedStrings
Graphics/Model/MikuMikuDance/Types.hs
Graphics/Model/Obj.hs
    OverloadedStrings
    TupleSections

I would expect it to find the source code relative to the given cabal file.

Also, as a feature request, it might be nice if I can just pass a path to a directory, and it will use the (existing) logic to find the .cabal file therein.

@fredefox
Copy link

Perhaps getPackageExtensions could be redefined to:

import qualified Extensions
import qualified System.Directory as Directory
import qualified System.FilePath as FilePath

getPackageExtensions :: FilePath -> IO (Map FilePath Extensions.ExtensionsResult)
getPackageExtensions p
  = Directory.withCurrentDirectory (FilePath.takeBaseName p)
  $ Extensions.getPackageExtentions (FilePath.takeFileName p)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants