Skip to content

Commit

Permalink
Added canonicalFile
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Mar 3, 2025
1 parent 4ffb2c9 commit 80eac6b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,10 @@ class PythonLanguageFrontend(language: Language<PythonLanguageFrontend>, ctx: Tr

// We need to resolve the path relative to the top level to get the full module identifier
// with packages. Note: in reality, only directories that have __init__.py file present are
// actually packages, but we skip this for now
var relative = path.relativeToOrNull(topLevel.toPath())
// actually packages, but we skip this for now. Since we are dealing with potentially
// relative paths, we need to canonicalize both paths.
var relative =
path.toFile().canonicalFile.relativeToOrNull(topLevel.canonicalFile)?.toPath()
var module = path.nameWithoutExtension
var modulePaths = (relative?.parent?.pathString?.split("/") ?: listOf()) + module

Expand Down

0 comments on commit 80eac6b

Please sign in to comment.