Skip to content

Commit

Permalink
SLI-1436 Analysis in CLion on Windows does not work (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed May 31, 2024
1 parent d41363a commit 6090ec3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ import com.intellij.openapi.project.ProjectCoreUtil
import com.intellij.openapi.vfs.VirtualFile
import java.net.URI
import java.net.URISyntaxException
import org.sonarlint.intellij.common.util.SonarLintUtils.getService
import org.sonarsource.sonarlint.core.client.utils.ClientLogOutput

object VirtualFileUtils {
fun toURI(file: VirtualFile): URI? {
return try {
URI(file.url.replace(" ", "%20"))
if (file.isInLocalFileSystem) {
URI("${file.fileSystem.protocol}:///${file.path}".replace(" ", "%20"))
} else {
null
}
} catch (e: URISyntaxException) {
getService(GlobalLogOutput::class.java).log("Could not transform ${file.url} to URI", ClientLogOutput.Level.DEBUG)
null
}
}
Expand Down

0 comments on commit 6090ec3

Please sign in to comment.