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

Fix discovery with absolute paths #92

Merged
merged 4 commits into from
Jun 29, 2024
Merged

Fix discovery with absolute paths #92

merged 4 commits into from
Jun 29, 2024

Conversation

tfausak
Copy link
Owner

@tfausak tfausak commented Jun 29, 2024

Fixes #89.

@tfausak tfausak added the bug Something isn't working label Jun 29, 2024
$ if null incs then ["**"] else incs
files <- Trans.lift $ MonadWalk.walk "." inclusions exclusions
files <- Trans.lift $ MonadWalk.walk root inclusions exclusions
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic idea of this fix is that we'll use root rather than the current directory to search for files. The files returned are relative to the root, and the inclusions and exclusions are also evaluated relative to the root. So everything works out nicely without having to do too much.

Removing a lot of calls to combine root is a nice bonus.

" N.M2"
]
d <- Directory.getCurrentDirectory
Gild.mainWith ["--input", FilePath.combine d "i.cabal", "--output=r.cabal"]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had a pure test for this, but I think it makes more sense to test using the real file system. Windows paths are weird, and using the actual filesystem exercises the functionality without jumping through a bunch of hoops.

@tfausak tfausak enabled auto-merge (squash) June 29, 2024 22:35
@tfausak tfausak merged commit e8b01de into main Jun 29, 2024
9 checks passed
@tfausak tfausak deleted the gh-89-fix-discover branch June 29, 2024 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cabal-gild-1.3.2 breaks discover src
1 participant