From bbd606f564ced0f6605e3e5dafbe5c9bc6b4faaa Mon Sep 17 00:00:00 2001 From: rihi <19492038+rihi@users.noreply.github.com> Date: Sat, 5 Nov 2022 16:01:48 +0100 Subject: [PATCH] Select gui/cli based on if command line arguments are present --- src/main/java/info/ata4/bspsrc/BspSourceLauncher.java | 10 +++++----- src/main/java/info/ata4/bspsrc/gui/BspSourceFrame.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/info/ata4/bspsrc/BspSourceLauncher.java b/src/main/java/info/ata4/bspsrc/BspSourceLauncher.java index edca2c4c..c07c4948 100644 --- a/src/main/java/info/ata4/bspsrc/BspSourceLauncher.java +++ b/src/main/java/info/ata4/bspsrc/BspSourceLauncher.java @@ -13,8 +13,8 @@ import info.ata4.bspsrc.gui.BspSourceFrame; /** - * Simple launcher that starts the CLI if there's a console available or the GUI - * otherwise. + * Simple launcher that starts the CLI if any command + * line arguments are present or the GUI otherwise. * * @author Nico Bergemann */ @@ -23,9 +23,9 @@ public class BspSourceLauncher { /** * @param args the command line arguments */ - public static void main(String args[]) { - if (System.console() == null) { - BspSourceFrame.main(args); + public static void main(String[] args) { + if (args.length == 0) { + BspSourceFrame.main(); } else { BspSourceCli.main(args); } diff --git a/src/main/java/info/ata4/bspsrc/gui/BspSourceFrame.java b/src/main/java/info/ata4/bspsrc/gui/BspSourceFrame.java index 53aa281f..875aed1b 100644 --- a/src/main/java/info/ata4/bspsrc/gui/BspSourceFrame.java +++ b/src/main/java/info/ata4/bspsrc/gui/BspSourceFrame.java @@ -49,7 +49,7 @@ public class BspSourceFrame extends javax.swing.JFrame { /** * @param args the command line arguments */ - public static void main(String args[]) { + public static void main() { LogUtils.configure(); // set the system look and feel