String appBaseProv = null;
applicationFolder = System.getProperty("installer.application_folder");
installerAppdir = System.getProperty(APPLICATION_APPDIR_PROPERTY);
-
appName = System.getProperty("channel.app_name");
// start with bootstrap.properties config, if avaialble
return hash.substring(0,8);
}
- protected static final String getUserAppdir() {
+ public static final String getUserAppdir() {
final String noUseDefaultAppDirProperty = "no" + USER_DEFAULT_APPDIR_PROPERTY;
if (Boolean.valueOf(System.getProperty(noUseDefaultAppDirProperty))) {
System.err.println("Not using default user appdir because property '" + noUseDefaultAppDirProperty + "' is '" + System.getProperty(noUseDefaultAppDirProperty) + "'");
}
String appdirname = applicationFolder == null || applicationFolder.length() == 0 ? ChannelProperties.FALLBACK_APPNAME : applicationFolder;
String home = System.getProperty("user.home");
+ // for times when using this method without running GetdownApp
+ if (appName == null) {
+ appName = System.getProperty("channel.app_name");
+ }
+ if (installerAppdir == null) {
+ installerAppdir = System.getProperty(APPLICATION_APPDIR_PROPERTY);
+ }
String appname = StringUtil.isBlank(appName) ? ChannelProperties.FALLBACK_APPNAME : appName;
final String FS = File.separator;
String appDirHash;
private static String appName = null;
- protected static final String USER_DEFAULT_APPDIR_PROPERTY = "userdefaultappdir";
+ public static final String USER_DEFAULT_APPDIR_PROPERTY = "userdefaultappdir";
protected static final String APPLICATION_APPDIR_PROPERTY = "installer.appdir";
import java.nio.file.Paths;
import java.util.Locale;
-import javax.xml.bind.DatatypeConverter;
-
import java.security.MessageDigest;
import jalview.util.ChannelProperties;
MessageDigest md = MessageDigest.getInstance(algo);
md.update(Files.readAllBytes(Paths.get(file.getAbsolutePath())));
byte[] digest = md.digest();
- checksum = DatatypeConverter.printHexBinary(digest).toUpperCase(Locale.ROOT);
+ checksum = printHexBinary(digest).toUpperCase(Locale.ROOT);
} catch (Exception e) {
System.out.println("Couldn't create "+algo+" digest of "+file.getPath());
}
// can't grab system properties; we'll just pretend we're not on any of these OSes
}
}
+
+ private static String printHexBinary(byte[] bytes) {
+ if (bytes == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(byteToHex(bytes[i]));
+ }
+ return sb.toString();
+ }
+
+ private static String byteToHex(byte num) {
+ char[] hexDigits = new char[2];
+ hexDigits[0] = Character.forDigit((num >> 4) & 0xF, 16);
+ hexDigits[1] = Character.forDigit((num & 0xF), 16);
+ return new String(hexDigits);
+ }
+
}
--- /dev/null
+package jalview.bin;
+
+import java.io.File;
+
+import com.threerings.getdown.data.EnvConfig;
+import com.threerings.getdown.util.LaunchUtil;
+
+public class GetdownLauncherUpdate
+{
+ public static void main(String[] args)
+ {
+ String appdir = args.length > 0 ? args[0] : null;
+ if (appdir == null || appdir.length() == 0)
+ {
+ appdir = System.getProperty("launcher.appdir", null);
+ }
+ if (appdir == null)
+ {
+ appdir = EnvConfig.getUserAppdir();
+ }
+ if (appdir == null)
+ {
+ System.err.println("Not running upgradeGetdown");
+ return;
+ }
+ boolean debug = false;
+ for (int i = 0; i < args.length; i++)
+ {
+ if ("--debug".equals(args[i]))
+ {
+ debug = true;
+ break;
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Running upgradeGetdown");
+ }
+ File appdirFile = new File(appdir);
+ if (!appdirFile.exists())
+ {
+ System.err.println("Directory '" + appdirFile.getAbsolutePath()
+ + "' doesn't exist, cannot update getdown-launcher.jar.");
+ if (Boolean.valueOf(System.getProperty("launcher.update")))
+ {
+ System.exit(1);
+ }
+ }
+ LaunchUtil.upgradeGetdown(new File(appdir, "getdown-launcher-old.jar"),
+ new File(appdir, "getdown-launcher.jar"),
+ new File(appdir, "getdown-launcher-new.jar"));
+ }
+}
private static String prefix = null;
+ private static boolean quiet = false;
+
public static void setHasConsole(boolean b)
{
hasConsole = b;
}
+ public static void setQuiet(boolean b)
+ {
+ quiet = b;
+ }
+
public static void setPrefix(String s)
{
prefix = s;
public static void println(String message0, boolean err,
boolean thisHasConsole)
{
+ if (!err && quiet)
+ {
+ return;
+ }
String message = prefix == null ? message0 : prefix + message0;
if (thisHasConsole && hasConsole)
{
getdown_launcher = getdown-launcher.jar
getdown_launcher_local = getdown-launcher-local.jar
getdown_launcher_new = getdown-launcher-new.jar
-getdown_core = getdown/lib/getdown-core.jar
getdown_build_properties = build_properties
getdown_launch_jvl_name = channel_launch
getdown_images_dir = utils/getdown
# now got better (dynamic) defaults when jvmmem* not set
#getdown_txt_jalview.jvmmempc = 90
#getdown_txt_jalview.jvmmemmax = 32G
+getdown_txt_resource = getdown/lib/getdown-core.jar
getdown_txt_strict_comments = true
getdown_txt_ui.progress_sync_before_shown = true
getdown_txt_ui.progress_sync_after_shown = false
--- /dev/null
+package jalview.bin;
+
+import java.io.File;
+
+import com.threerings.getdown.data.EnvConfig;
+import com.threerings.getdown.util.LaunchUtil;
+
+public class GetdownLauncherUpdate
+{
+ public static void main(String[] args)
+ {
+ String appdir = args.length > 0 ? args[0] : null;
+ if (appdir == null || appdir.length() == 0)
+ {
+ appdir = System.getProperty("launcher.appdir", null);
+ }
+ if (appdir == null)
+ {
+ appdir = EnvConfig.getUserAppdir();
+ }
+ if (appdir == null)
+ {
+ System.err.println("Not running upgradeGetdown");
+ return;
+ }
+ boolean debug = false;
+ for (int i = 0; i < args.length; i++)
+ {
+ if ("--debug".equals(args[i]))
+ {
+ debug = true;
+ break;
+ }
+ }
+ if (debug)
+ {
+ System.err.println("Running upgradeGetdown");
+ }
+ File appdirFile = new File(appdir);
+ if (!appdirFile.exists())
+ {
+ System.err.println("Directory '" + appdirFile.getAbsolutePath()
+ + "' doesn't exist, cannot update getdown-launcher.jar.");
+ if (Boolean.valueOf(System.getProperty("launcher.update")))
+ {
+ System.exit(1);
+ }
+ }
+ LaunchUtil.upgradeGetdown(new File(appdir, "getdown-launcher-old.jar"),
+ new File(appdir, "getdown-launcher.jar"),
+ new File(appdir, "getdown-launcher-new.jar"));
+ }
+}
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.themes.FlatMacLightLaf;
import com.formdev.flatlaf.util.SystemInfo;
-import com.threerings.getdown.util.LaunchUtil;
//import edu.stanford.ejalbert.launching.IBrowserLaunching;
import groovy.lang.Binding;
String appdirString = System.getProperty("launcher.appdir");
if (appdirString != null && appdirString.length() > 0)
{
- final File appdir = new File(appdirString);
new Thread()
{
@Override
public void run()
{
- LaunchUtil.upgradeGetdown(
- new File(appdir, "getdown-launcher-old.jar"),
- new File(appdir, "getdown-launcher.jar"),
- new File(appdir, "getdown-launcher-new.jar"));
+ GetdownLauncherUpdate.main(new String[] { appdirString });
}
}.start();
}
headless = assumeheadless;
}
+ ErrorLog.setQuiet(quiet);
+
final String appName = ChannelProperties.getProperty("app_name");
// if we're using jalview.bin.Launcher we always assume a console is in use
String scalePropertyArg = HiDPISetting.getScalePropertyArg();
if (scalePropertyArg != null)
{
- LaunchUtils.syserr(debug, quiet, "Running " + startClass
- + " with scale setting " + scalePropertyArg);
+ ErrorLog.errPrintln("Running " + startClass + " with scale setting "
+ + scalePropertyArg);
addJvmArgs.add(scalePropertyArg);
}
addJvmArgs, null, null, null, startClass, null, null, arguments,
launcherprint, launcherwait, launcherstop, debug, quiet);
- LaunchUtils.syserr(debug, quiet, "JVM exited with value " + exitValue);
+ ErrorLog.errPrintln("JVM exited with value " + exitValue);
}
}
private static String prefix = null;
+ private static boolean quiet = false;
+
public static void setHasConsole(boolean b)
{
hasConsole = b;
}
+ public static void setQuiet(boolean b)
+ {
+ quiet = b;
+ }
+
public static void setPrefix(String s)
{
prefix = s;
public static void println(String message0, boolean err,
boolean thisHasConsole)
{
+ if (!err && quiet)
+ {
+ return;
+ }
String message = prefix == null ? message0 : prefix + message0;
if (thisHasConsole && hasConsole)
{