Skip to content

Commit

Permalink
PlatformCompat: inline fixPathOnNativeWindows
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Feb 2, 2025
1 parent bdccbae commit 5c9e607
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,8 @@ trait CliTestBehavior {
ExitCode.TestError,
assertOut = out => {
assertContains(out, "bar.scala")
assertContains(
out,
PlatformCompat.fixPathOnNativeWindows("dir/foo.scala"),
)
val bslash = PlatformCompat.isNativeOnWindows
assertContains(out, if (bslash) "dir\\foo.scala" else "dir/foo.scala")
assertNotContains(out, "baz.scala")
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import scala.concurrent.ExecutionContext
private[scalafmt] object PlatformCompat {
def isScalaNative = false
def prepareCommand(cmd: Seq[String]) = cmd
def fixPathOnNativeWindows(path: String) = path
def isNativeOnWindows = false

implicit def executionContext: ExecutionContext = ExecutionContext.global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ private[scalafmt] object PlatformCompat {
def isScalaNative = true
def prepareCommand(cmd: Seq[String]) =
if (Platform.isWindows()) cmd.map(arg => s""""$arg"""") else cmd
def fixPathOnNativeWindows(path: String) =
if (Platform.isWindows()) path.replace('/', '\\') else path
def isNativeOnWindows = Platform.isWindows()

implicit def executionContext: ExecutionContext = ExecutionContext.global
Expand Down

0 comments on commit 5c9e607

Please sign in to comment.