Skip to content

Commit 5b52a6f

Browse files
author
jantje
committed
on windows a warning pops up if bash and/or sh is found in the path
When Bash or sh is in the path on windows it seems there are problems. This is just a (ugly) popup telling there is a problem.
1 parent e4c0b69 commit 5b52a6f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/ui/Activator.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import it.baeyens.arduino.listeners.IndexerListener;
3636
import it.baeyens.arduino.listeners.ProjectExplorerListener;
3737
import it.baeyens.arduino.managers.Manager;
38+
import it.baeyens.arduino.tools.ExternalCommandLauncher;
3839

3940
/**
4041
* generated code
@@ -54,13 +55,49 @@ public class Activator implements BundleActivator {
5455

5556
@Override
5657
public void start(BundleContext context) throws Exception {
58+
testKnownIssues();
5759
initializeImportantVariables();
5860
runPluginCoreStartInstantiatorJob();
5961
runGUIRegistration();
6062
runInstallJob();
6163

6264
}
6365

66+
private static void testKnownIssues() {
67+
if (Platform.getOS().equals(Platform.OS_WIN32)) {
68+
String bashCommand = "bash --version"; //$NON-NLS-1$
69+
String shCommand = "sh --version"; //$NON-NLS-1$
70+
boolean bashFound = false;
71+
ExternalCommandLauncher bashCommandLauncher = new ExternalCommandLauncher(bashCommand);
72+
try {
73+
bashFound = (bashCommandLauncher.launch(null) == 0);
74+
} catch (IOException e) {
75+
// nothing to do here
76+
}
77+
boolean shFound = false;
78+
ExternalCommandLauncher shCommandLauncher = new ExternalCommandLauncher(shCommand);
79+
try {
80+
shFound = (shCommandLauncher.launch(null) == 0);
81+
} catch (IOException e) {
82+
// nothing to do here
83+
}
84+
String errorString = Const.EMPTY_STRING;
85+
String addString = Const.EMPTY_STRING;
86+
if (bashFound) {
87+
errorString = errorString + addString + "bash"; //$NON-NLS-1$
88+
addString = " and "; //$NON-NLS-1$
89+
}
90+
if (shFound) {
91+
errorString = errorString + addString + "sh"; //$NON-NLS-1$
92+
addString = " and "; //$NON-NLS-1$
93+
}
94+
if (!errorString.isEmpty()) {
95+
errorString += " found on your system. \nThe plugin will not work properly."; //$NON-NLS-1$
96+
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, errorString));
97+
}
98+
}
99+
}
100+
64101
private static void registerListeners() {
65102
// TODO Auto-generated method stub
66103
IndexerListener myindexerListener = new IndexerListener();

0 commit comments

Comments
 (0)