35
35
import it .baeyens .arduino .listeners .IndexerListener ;
36
36
import it .baeyens .arduino .listeners .ProjectExplorerListener ;
37
37
import it .baeyens .arduino .managers .Manager ;
38
+ import it .baeyens .arduino .tools .ExternalCommandLauncher ;
38
39
39
40
/**
40
41
* generated code
@@ -54,13 +55,49 @@ public class Activator implements BundleActivator {
54
55
55
56
@ Override
56
57
public void start (BundleContext context ) throws Exception {
58
+ testKnownIssues ();
57
59
initializeImportantVariables ();
58
60
runPluginCoreStartInstantiatorJob ();
59
61
runGUIRegistration ();
60
62
runInstallJob ();
61
63
62
64
}
63
65
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. \n The plugin will not work properly." ; //$NON-NLS-1$
96
+ Common .log (new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID , errorString ));
97
+ }
98
+ }
99
+ }
100
+
64
101
private static void registerListeners () {
65
102
// TODO Auto-generated method stub
66
103
IndexerListener myindexerListener = new IndexerListener ();
0 commit comments