Skip to content

Commit 7adba22

Browse files
committed
Fix issue with finding jar on Windows
1 parent 5791997 commit 7adba22

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/de/fraunhofer/iem/swan/assist/ui/dialog/SwanLauncherDialog.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.intellij.openapi.ui.MessageType;
66
import com.intellij.openapi.ui.popup.Balloon;
77
import com.intellij.openapi.ui.popup.JBPopupFactory;
8+
import com.sun.javafx.PlatformUtil;
89
import de.fraunhofer.iem.swan.assist.data.JSONFileLoader;
910
import de.fraunhofer.iem.swan.assist.util.Constants;
1011
import org.jetbrains.annotations.Nullable;
@@ -51,7 +52,13 @@ public SwanLauncherDialog(Project project, boolean modal) {
5152
File configurationFile = new File(JSONFileLoader.getConfigurationFile(true));
5253

5354
defaultTrainDirectory = Objects.requireNonNull(getClass().getClassLoader().getResource("")).getPath() + Constants.SWAN_TRAIN_DIR_NAME;
54-
swanJarDirecory = Objects.requireNonNull(getClass().getClassLoader().getResource(Constants.SWAN_JAR_NAME)).getPath();
55+
56+
String jarDir = Objects.requireNonNull(getClass().getClassLoader().getResource(Constants.SWAN_JAR_NAME)).getPath();
57+
58+
if (PlatformUtil.isWindows() || System.getProperty("os.name").toLowerCase().contains("win"))
59+
swanJarDirecory = jarDir.substring(1);
60+
else
61+
swanJarDirecory = jarDir;
5562

5663
sourceDirTextbox.setText(project.getBasePath());
5764
configDir.setText(configurationFile.getAbsolutePath());

0 commit comments

Comments
 (0)