From b8417e561982e33d324558c4fb8011f7595f263a Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Sun, 19 May 2024 17:29:16 +0200 Subject: [PATCH] removed Mac specific code which is not working any more on recent Macs --- source/net/yacy/gui/Tray.java | 16 ---------------- source/net/yacy/yacy.java | 20 -------------------- 2 files changed, 36 deletions(-) diff --git a/source/net/yacy/gui/Tray.java b/source/net/yacy/gui/Tray.java index 6ac7e84ce..3fbf245b1 100644 --- a/source/net/yacy/gui/Tray.java +++ b/source/net/yacy/gui/Tray.java @@ -151,22 +151,6 @@ public final class Tray { private static Object applicationInstance; private static Method setDockIconImage; - static { - Class applicationClass = null; - try { - applicationClass = Class.forName("com.apple.eawt.Application"); - final Method applicationGetApplication = applicationClass.getMethod("getApplication"); - applicationInstance = applicationGetApplication.invoke(null); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - ConcurrentLog.logException(e); - } - if (applicationClass != null) try { - setDockIconImage = applicationClass.getMethod("setDockIconImage", Class.forName("java.awt.Image")); - } catch (ClassNotFoundException | SecurityException | IllegalArgumentException | NoSuchMethodException e) { - ConcurrentLog.logException(e); - } - } - private static void setDockIcon(final Image icon) { if (!OS.isMacArchitecture || setDockIconImage == null || applicationInstance == null) return; try { diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index c3420a109..fdf24519d 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -722,26 +722,6 @@ public final class yacy { // case for the application path if started normally with a jre command File applicationRoot = new File(System.getProperty("user.dir").replace('\\', '/')); - - // try to find the application root path within a Mac application - // call com.apple.eio.FileManager.getPathToApplicationBundle(); - if (!OS.isWindows) { // prevent that YaCy always starts with an exception message on none Apple systems - try { - // these methods will cause a warning: remove them with --illegal-access=permit - final Class comAppleEioFileManagerClass = Class.forName("com.apple.eio.FileManager"); - final Method getPathToApplicationBundleMethod = ClassProvider.getStaticMethod(comAppleEioFileManagerClass, "getPathToApplicationBundle", null); - final String apppath = (String) getPathToApplicationBundleMethod.invoke(null); - System.out.println("PathToApplicationBundle = " + apppath); // PathToApplicationBundle = /Users/admin/git/rc1/build/YaCy.app - if (apppath != null && apppath.endsWith(".app")) { - // modify the applicationRoot path to within the app file - applicationRoot = new File(apppath + "/Contents"); - System.setProperty("user.dir", applicationRoot.getAbsolutePath()); // required since nasty code elswhere is using it - System.setProperty("user.home", applicationRoot.getAbsolutePath()); // well - } - } catch (ClassNotFoundException | InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { - e.printStackTrace(); - } - } File dataRoot = applicationRoot; //System.out.println("args.length=" + args.length); //System.out.print("args=["); for (int i = 0; i < args.length; i++) System.out.print(args[i] + ", "); System.out.println("]");