mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 22:09:47 -04:00
Read user-defined Java System Properties from ~/.filebot/system.properties
This commit is contained in:
parent
0815aa6532
commit
e5f3596347
@ -1,7 +1,6 @@
|
|||||||
package net.filebot;
|
package net.filebot;
|
||||||
|
|
||||||
import static java.awt.GraphicsEnvironment.*;
|
import static java.awt.GraphicsEnvironment.*;
|
||||||
import static java.util.Arrays.*;
|
|
||||||
import static java.util.stream.Collectors.*;
|
import static java.util.stream.Collectors.*;
|
||||||
import static net.filebot.ExitCode.*;
|
import static net.filebot.ExitCode.*;
|
||||||
import static net.filebot.Logging.*;
|
import static net.filebot.Logging.*;
|
||||||
@ -16,6 +15,7 @@ import static net.filebot.util.ui.SwingUI.*;
|
|||||||
|
|
||||||
import java.awt.Dialog.ModalityType;
|
import java.awt.Dialog.ModalityType;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.security.CodeSource;
|
import java.security.CodeSource;
|
||||||
@ -26,6 +26,7 @@ import java.security.Policy;
|
|||||||
import java.security.ProtectionDomain;
|
import java.security.ProtectionDomain;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
@ -220,14 +221,9 @@ public class Main {
|
|||||||
setTheme();
|
setTheme();
|
||||||
|
|
||||||
// start standard frame or single panel frame
|
// start standard frame or single panel frame
|
||||||
PanelBuilder[] panels = args.getPanelBuilders();
|
List<PanelBuilder> panels = args.getPanelBuilders();
|
||||||
|
|
||||||
// MAS does not allow subtitle applications
|
JFrame frame = panels.size() > 1 ? new MainFrame(panels) : new SinglePanelFrame(panels.get(0));
|
||||||
if (isMacSandbox()) {
|
|
||||||
panels = stream(panels).filter(p -> !p.getName().equals("Subtitles")).toArray(PanelBuilder[]::new);
|
|
||||||
}
|
|
||||||
|
|
||||||
JFrame frame = panels.length > 1 ? new MainFrame(panels) : new SinglePanelFrame(panels[0]);
|
|
||||||
try {
|
try {
|
||||||
restoreWindowBounds(frame, Settings.forPackage(MainFrame.class)); // restore previous size and location
|
restoreWindowBounds(frame, Settings.forPackage(MainFrame.class)); // restore previous size and location
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -383,7 +379,7 @@ public class Main {
|
|||||||
System.setSecurityManager(new SecurityManager());
|
System.setSecurityManager(new SecurityManager());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// security manager was probably set via system property
|
// security manager was probably set via system property
|
||||||
debug.log(Level.WARNING, e.getMessage(), e);
|
debug.log(Level.WARNING, e, e::getMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,6 +392,18 @@ public class Main {
|
|||||||
System.setProperty("grape.root", ApplicationFolder.AppData.resolve("grape").getPath());
|
System.setProperty("grape.root", ApplicationFolder.AppData.resolve("grape").getPath());
|
||||||
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
|
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
|
||||||
|
|
||||||
|
// set additional user-defined default system properties
|
||||||
|
File userDefinedSystemProperties = ApplicationFolder.AppData.resolve("system.properties");
|
||||||
|
if (userDefinedSystemProperties.isFile()) {
|
||||||
|
try (FileInputStream in = new FileInputStream(userDefinedSystemProperties)) {
|
||||||
|
Properties p = new Properties();
|
||||||
|
p.load(in);
|
||||||
|
p.forEach((k, v) -> System.setProperty(k.toString(), v.toString()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.log(Level.WARNING, e, e::getMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.unixfs) {
|
if (args.unixfs) {
|
||||||
System.setProperty("unixfs", "true");
|
System.setProperty("unixfs", "true");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user