3535import it .baeyens .arduino .listeners .IndexerListener ;
3636import it .baeyens .arduino .listeners .ProjectExplorerListener ;
3737import 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. \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+
64101 private static void registerListeners () {
65102 // TODO Auto-generated method stub
66103 IndexerListener myindexerListener = new IndexerListener ();
0 commit comments