@@ -65,8 +65,8 @@ public class BaseNoGui {
6565 VERSION_NAME_LONG = versionNameLong ;
6666 }
6767
68- private static DiscoveryManager discoveryManager = new DiscoveryManager () ;
69-
68+ private static DiscoveryManager discoveryManager ;
69+
7070 // these are static because they're used by Sketch
7171 static private File examplesFolder ;
7272 static private File toolsFolder ;
@@ -446,12 +446,6 @@ static public void init(String[] args) throws Exception {
446446
447447 BaseNoGui .initPackages ();
448448
449- // refresh the serial port names after loading all packages
450- BaseNoGui .getDiscoveryManager ().getSerialDiscoverer ().forceRefresh ();
451-
452- // Setup board-dependent variables.
453- onBoardOrPortChange ();
454-
455449 parser .parseArgumentsPhase2 ();
456450
457451 for (String path : parser .getFilenames ()) {
@@ -481,7 +475,10 @@ static public void init(String[] args) throws Exception {
481475 showError (null , mess , 2 );
482476 }
483477 }
484-
478+
479+ // Setup board-dependent variables.
480+ onBoardOrPortChange ();
481+
485482 // Save the preferences. For GUI mode, this happens in the quit
486483 // handler, but for other modes we should also make sure to save
487484 // them.
@@ -608,6 +605,9 @@ static public void initLogger() {
608605 }
609606
610607 static public void initPackages () throws Exception {
608+
609+ discoveryManager = new DiscoveryManager ();
610+
611611 indexer = new ContributionsIndexer (getSettingsFolder (), getHardwareFolder (), getPlatform (),
612612 new GPGDetachedSignatureVerifier ());
613613
0 commit comments