@@ -61,14 +61,15 @@ public class Main extends Application {
6161 @ Inject private HttpPipelineSwitcher pipelineSwitcher ;
6262 private Parent root ;
6363 private boolean headless ;
64+ private List <String > parameters ;
6465
6566 public static void main (String [] args ) {
6667 launch (args );
6768 }
6869
6970 @ Override
7071 public void init () throws IOException {
71- List < String > parameters = new ArrayList <>(getParameters ().getRaw ());
72+ parameters = new ArrayList <>(getParameters ().getRaw ());
7273
7374 if (parameters .contains ("--headless" )) {
7475 // If --headless was specified on the command line, run in headless mode (only use the core
@@ -99,16 +100,6 @@ public void init() throws IOException {
99100 server .start ();
100101 notifyPreloader (new Preloader .ProgressNotification (0.6 ));
101102
102- // If there was a file specified on the command line, open it immediately
103- if (!parameters .isEmpty ()) {
104- try {
105- project .open (new File (parameters .get (0 )));
106- } catch (IOException e ) {
107- logger .log (Level .SEVERE , "Error loading file: " + parameters .get (0 ));
108- throw e ;
109- }
110- }
111-
112103 pipelineRunner .startAsync ();
113104 notifyPreloader (new Preloader .ProgressNotification (0.75 ));
114105 }
@@ -124,6 +115,16 @@ public void start(Stage stage) throws IOException {
124115 cvOperations .addOperations ();
125116 notifyPreloader (new Preloader .ProgressNotification (0.9 ));
126117
118+ // If there was a file specified on the command line, open it immediately
119+ if (!parameters .isEmpty ()) {
120+ try {
121+ project .open (new File (parameters .get (0 )));
122+ } catch (IOException e ) {
123+ logger .log (Level .SEVERE , "Error loading file: " + parameters .get (0 ));
124+ throw e ;
125+ }
126+ }
127+
127128 project .addIsSaveDirtyConsumer (newValue -> {
128129 if (newValue ) {
129130 Platform .runLater (() -> stage .setTitle (MAIN_TITLE + " | Edited" ));
0 commit comments