Skip to content

Commit bec1394

Browse files
author
Olafur Pall Geirsson
committed
Absolutize and normalize paths before writing SemanticDB.
1 parent 503b952 commit bec1394

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,16 @@ object ExtractSemanticDB {
158158
val name: String = "extractSemanticDB"
159159

160160
def write(source: SourceFile, occurrences: List[SymbolOccurrence])(given ctx: Context): Unit =
161-
val sourcePath = source.file.jpath
162-
val sourceRoot = Paths.get(ctx.settings.sourceroot.value)
161+
def absolutePath(path: Path): Path = path.toAbsolutePath.normalize
162+
val sourcePath = absolutePath(source.file.jpath)
163+
val sourceRoot = absolutePath(Paths.get(ctx.settings.sourceroot.value))
163164
val targetRoot =
164165
val targetRootSetting = ctx.settings.targetroot.value
165-
if targetRootSetting.isEmpty then ctx.settings.outputDir.value.jpath
166-
else Paths.get(targetRootSetting)
167-
println(i"extract from $sourcePath from $sourceRoot, targetRoot = $targetRoot")
166+
absolutePath(
167+
if targetRootSetting.isEmpty then ctx.settings.outputDir.value.jpath
168+
else Paths.get(targetRootSetting)
169+
)
168170
val relPath = sourceRoot.relativize(sourcePath)
169-
println(i"relPath = $relPath")
170171
val relURI = relPath.iterator().asScala.mkString("/")
171172
val outpath = targetRoot
172173
.resolve("META-INF")

0 commit comments

Comments
 (0)