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: check every module when looking if a file is inside the project #164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mgarciavaadin
Copy link
Contributor

Description

To check if a file was inside the project we were only checking the project base folder which is not accurate when the project has external modules.
The fix looks in every module in the project including the base project.

Fixes #163

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

Copy link

Artifact build on last commit: distributions.zip.
For MacOS users: there is a zip inside this zip and Finder unzips them both at once. Use unzip distributions.zip from Terminal or check solution for Archive Manager.

* project base folders. For the main project, the base directory is the project root and the module name is
* "base-module".
*/
fun getBaseDirectoriesForProject(project: Project): Map<String, List<String>> {
Copy link
Member

Choose a reason for hiding this comment

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

Uses same code as in GetModulePathsHandler, might be somehow unified.

@@ -45,7 +46,9 @@ abstract class AbstractHandler(val project: Project) : Handler {
fun isFileInsideProject(project: Project, file: File): Boolean {
if (file.exists()) {
val path = file.toPath()
return path.toRealPath().startsWith(project.basePath!!)
Copy link
Member

Choose a reason for hiding this comment

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

Can you try if changing to project.guessProjectDir() changes anything?

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

Successfully merging this pull request may close these issues.

AbstractHandler::isFileInsidePRoject not working when using external modules
2 participants