@@ -2,6 +2,7 @@ package com.github.codeql
22
33import com.github.codeql.utils.versions.usesK2
44import com.semmle.util.files.FileUtil
5+ import com.semmle.util.trap.pathtransformers.PathTransformer
56import java.io.BufferedInputStream
67import java.io.BufferedOutputStream
78import java.io.BufferedReader
@@ -371,9 +372,9 @@ private fun doFile(
371372 context.clear()
372373 }
373374
374- val srcFileRelativePath = srcFilePath.replace( ' : ' , ' _ ' )
375+ val srcFileRelativePath = PathTransformer .std().fileAsDatabaseString( File (srcFilePath) )
375376
376- val dbSrcFilePath = Paths .get( " $ dbSrcDir/ $ srcFileRelativePath" )
377+ val dbSrcFilePath = FileUtil .appendAbsolutePath( dbSrcDir, srcFileRelativePath).toPath( )
377378 val dbSrcDirPath = dbSrcFilePath.parent
378379 Files .createDirectories(dbSrcDirPath)
379380 val srcTmpFile =
@@ -385,7 +386,7 @@ private fun doFile(
385386 srcTmpFile.outputStream().use { Files .copy(Paths .get(srcFilePath), it) }
386387 srcTmpFile.renameTo(dbSrcFilePath.toFile())
387388
388- val trapFileName = " $dbTrapDir / $ srcFileRelativePath .trap"
389+ val trapFileName = FileUtil .appendAbsolutePath(dbTrapDir, " $ srcFileRelativePath .trap" ).getAbsolutePath()
389390 val trapFileWriter = getTrapFileWriter(compression, logger, trapFileName)
390391
391392 if (checkTrapIdentical || ! trapFileWriter.exists()) {
0 commit comments