Skip to content

Commit

Permalink
do not use backslash in import path (affects Windows only). fixes int…
Browse files Browse the repository at this point in the history
  • Loading branch information
mbolotov committed May 10, 2023
1 parent 8b5acec commit 7762eae
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import me.serce.solidity.lang.psi.SolPragmaDirective
import me.serce.solidity.lang.psi.SolPsiFactory
import me.serce.solidity.nullIfError
import java.awt.BorderLayout
import java.io.File
import java.nio.file.Paths
import javax.swing.Icon
import javax.swing.JPanel
Expand Down Expand Up @@ -127,7 +126,7 @@ class ImportFileAction(

fun buildImportPath(source: VirtualFile, destination: VirtualFile): String {
return Paths.get(source.path).parent.relativize(Paths.get(destination.path)).toString().let {
val separator = File.separator
val separator = "/"
when {
it.contains("node_modules$separator") -> {
val idx = it.indexOf("node_modules$separator")
Expand All @@ -145,7 +144,7 @@ class ImportFileAction(
!it.startsWith(".") -> ".$separator$it"
else -> it
}
}
}.replace("\\", "/")
}
}
}

0 comments on commit 7762eae

Please sign in to comment.