From 4bf36ebacf63fa2a470491e9a2a0572fd2e963b7 Mon Sep 17 00:00:00 2001 From: Linard Arquint Date: Mon, 26 Aug 2024 23:34:46 -0700 Subject: [PATCH] Fixes Issue #781 by converting paths first to absolut paths before resolving their parent path --- src/main/scala/viper/gobra/Gobra.scala | 2 +- src/main/scala/viper/gobra/frontend/Source.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/viper/gobra/Gobra.scala b/src/main/scala/viper/gobra/Gobra.scala index d7ffd5391..f3190a3cb 100644 --- a/src/main/scala/viper/gobra/Gobra.scala +++ b/src/main/scala/viper/gobra/Gobra.scala @@ -219,7 +219,7 @@ class Gobra extends GoVerifier with GoIdeVerifier { inFileConfig <- new ScallopGobraConfig(args, isInputOptional = true, skipIncludeDirChecks = true).config resolvedConfig = inFileConfig.copy(includeDirs = inFileConfig.includeDirs.map( // it's important to convert includeDir to a string first as `path` might be a ZipPath and `includeDir` might not - includeDir => Paths.get(input.name).getParent.resolve(includeDir.toString))) + includeDir => Paths.get(input.name).toAbsolutePath.getParent.resolve(includeDir.toString))) } yield Some(resolvedConfig) } }) diff --git a/src/main/scala/viper/gobra/frontend/Source.scala b/src/main/scala/viper/gobra/frontend/Source.scala index f7aff28fe..46a258c7b 100644 --- a/src/main/scala/viper/gobra/frontend/Source.scala +++ b/src/main/scala/viper/gobra/frontend/Source.scala @@ -65,7 +65,7 @@ object Source { * A unique identifier for packages */ val packageId: String = { - val prefix = uniquePath(TransformableSource(src).toPath.getParent, projectRoot).toString + val prefix = uniquePath(TransformableSource(src).toPath.toAbsolutePath.getParent, projectRoot).toString if(prefix.nonEmpty) { // The - is enough to unambiguously separate the prefix from the package name, since it can't occur in the package name // per Go's spec (https://go.dev/ref/spec#Package_clause)