Skip to content

Commit f817aa0

Browse files
authored
fix: path separator in vfs (#19061)
Fix decision on file separator character according to string instead of OS. Fix ide test to use same format for file path. Fixes #19046
1 parent 5675604 commit f817aa0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

vaadin-dev-server/src/main/java/com/vaadin/base/devserver/startup/DevModeInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ private static File getPhysicalFileOfJBossVfsJar(URL url)
469469
String vfsJarPath = url.toString();
470470
String fileNamePrefix = vfsJarPath.substring(
471471
vfsJarPath.lastIndexOf(
472-
FrontendUtils.isWindows() ? '\\' : '/') + 1,
472+
vfsJarPath.contains("\\") ? '\\' : '/') + 1,
473473
vfsJarPath.lastIndexOf(".jar"));
474474
Path tempJar = Files.createTempFile(fileNamePrefix, ".jar");
475475

vaadin-dev-server/src/test/java/com/vaadin/base/devserver/OpenInCurrentIdeTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
import java.util.Optional;
1010

1111
import org.junit.Assert;
12+
import org.junit.Assume;
1213
import org.junit.Test;
1314
import org.mockito.Mockito;
1415

16+
import com.vaadin.open.OSUtils;
17+
1518
public class OpenInCurrentIdeTest {
1619

1720
@Test
@@ -46,7 +49,8 @@ public void ideaOnMacDetected() throws IOException {
4649
// The binary on Mac is /.../IntelliJ IDEA.app/Contents/MacOS/idea
4750
Assert.assertEquals(
4851
new File(baseDirectory, "MacOS/idea").getAbsolutePath(),
49-
OpenInCurrentIde.getBinary(ideCommand.get()));
52+
new File(OpenInCurrentIde.getBinary(ideCommand.get()))
53+
.getAbsolutePath());
5054

5155
}
5256

@@ -605,6 +609,8 @@ private Info mock(String cmd, String cmdline) {
605609

606610
@Test
607611
public void runThrowsExceptionOnFailure() throws InterruptedException {
612+
Assume.assumeFalse(OSUtils.isWindows());
613+
608614
try {
609615
OpenInCurrentIde.run("/bin/sh", "-c",
610616
"echo 'output1'; echo 'output2'; exit 123");

0 commit comments

Comments
 (0)