mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-11 11:55:03 -05:00
* added -DuseNativeShell to jnlp
* don't create auto-create folders when not necessary * manually set java/jna.library.path to make sure it's in the install folder
This commit is contained in:
parent
306eda5c8a
commit
6963eb41eb
@ -18,3 +18,7 @@
|
|||||||
# http connection timeouts
|
# http connection timeouts
|
||||||
-Dsun.net.client.defaultConnectTimeout=5000
|
-Dsun.net.client.defaultConnectTimeout=5000
|
||||||
-Dsun.net.client.defaultReadTimeout=25000
|
-Dsun.net.client.defaultReadTimeout=25000
|
||||||
|
|
||||||
|
# look for native libs here
|
||||||
|
-Djna.library.path="%EXEDIR%"
|
||||||
|
-Djava.library.path="%EXEDIR%"
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
-Dsun.net.client.defaultConnectTimeout=5000
|
-Dsun.net.client.defaultConnectTimeout=5000
|
||||||
-Dsun.net.client.defaultReadTimeout=25000
|
-Dsun.net.client.defaultReadTimeout=25000
|
||||||
|
|
||||||
|
# look for native libs here
|
||||||
|
-Djna.library.path="%EXEDIR%"
|
||||||
|
-Djava.library.path="%EXEDIR%"
|
||||||
|
|
||||||
# force english locale
|
# force english locale
|
||||||
-Dfile.encoding=UTF-8
|
-Dfile.encoding=UTF-8
|
||||||
-Duser.country=US
|
-Duser.country=US
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<property name="application.deployment" value="webstart" />
|
<property name="application.deployment" value="webstart" />
|
||||||
<property name="application.update" value="skip" />
|
<property name="application.update" value="skip" />
|
||||||
<property name="jnlp.packEnabled" value="true" />
|
<property name="useNativeShell" value="true" />
|
||||||
|
|
||||||
<java version="1.6+" max-heap-size="256m" />
|
<java version="1.6+" max-heap-size="256m" />
|
||||||
|
<property name="jnlp.packEnabled" value="true" />
|
||||||
|
|
||||||
<jar href="filebot.jar" download="eager" main="true" />
|
<jar href="filebot.jar" download="eager" main="true" />
|
||||||
<jar href="groovy.jar" download="eager" />
|
<jar href="groovy.jar" download="eager" />
|
||||||
<jar href="icu4j.jar" download="eager" />
|
<jar href="icu4j.jar" download="eager" />
|
||||||
|
@ -26,7 +26,7 @@ public enum NativeRenameAction implements RenameAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File rename(File src, File dst) throws IOException {
|
public File rename(File src, File dst) throws IOException {
|
||||||
dst = resolveDestination(src, dst).getCanonicalFile();
|
dst = resolveDestination(src, dst, false).getCanonicalFile();
|
||||||
rename(singletonMap(src, dst));
|
rename(singletonMap(src, dst));
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
@ -40,13 +40,18 @@ public enum NativeRenameAction implements RenameAction {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (Entry<File, File> it : map.entrySet()) {
|
for (Entry<File, File> it : map.entrySet()) {
|
||||||
src[i] = it.getKey().getCanonicalPath();
|
src[i] = it.getKey().getCanonicalPath();
|
||||||
dst[i] = resolveDestination(it.getKey(), it.getValue()).getCanonicalPath();
|
dst[i] = resolveDestination(it.getKey(), it.getValue(), false).getCanonicalPath();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callNative_Shell32(this, src, dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void callNative_Shell32(NativeRenameAction action, String[] src, String[] dst) {
|
||||||
// configure parameter structure
|
// configure parameter structure
|
||||||
SHFILEOPSTRUCT op = new SHFILEOPSTRUCT();
|
SHFILEOPSTRUCT op = new SHFILEOPSTRUCT();
|
||||||
op.wFunc = (this == MOVE) ? ShellAPI.FO_MOVE : ShellAPI.FO_COPY;
|
op.wFunc = (action == MOVE) ? ShellAPI.FO_MOVE : ShellAPI.FO_COPY;
|
||||||
op.fFlags = Shell32.FOF_MULTIDESTFILES | Shell32.FOF_NOCONFIRMMKDIR;
|
op.fFlags = Shell32.FOF_MULTIDESTFILES | Shell32.FOF_NOCONFIRMMKDIR;
|
||||||
|
|
||||||
op.pFrom = new WString(op.encodePaths(src));
|
op.pFrom = new WString(op.encodePaths(src));
|
||||||
|
@ -50,8 +50,7 @@ public final class Settings {
|
|||||||
|
|
||||||
|
|
||||||
public static boolean useNativeShell() {
|
public static boolean useNativeShell() {
|
||||||
//TODO disable by default for final release
|
return Boolean.parseBoolean(System.getProperty("useNativeShell"));
|
||||||
return System.getProperty("useNativeShell") == null ? true : Boolean.parseBoolean(System.getProperty("useNativeShell"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +103,6 @@ public final class Settings {
|
|||||||
return new Settings(Preferences.userNodeForPackage(type));
|
return new Settings(Preferences.userNodeForPackage(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final Preferences prefs;
|
private final Preferences prefs;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public enum StandardRenameAction implements RenameAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File rename(File from, File to) throws Exception {
|
public File rename(File from, File to) throws Exception {
|
||||||
File destionation = FileUtilities.resolveDestination(from, to);
|
File destionation = FileUtilities.resolveDestination(from, to, true);
|
||||||
|
|
||||||
// move file and the create a symlink to the new location via NIO.2
|
// move file and the create a symlink to the new location via NIO.2
|
||||||
try {
|
try {
|
||||||
@ -48,7 +48,7 @@ public enum StandardRenameAction implements RenameAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File rename(File from, File to) throws Exception {
|
public File rename(File from, File to) throws Exception {
|
||||||
File destionation = FileUtilities.resolveDestination(from, to);
|
File destionation = FileUtilities.resolveDestination(from, to, true);
|
||||||
|
|
||||||
// create symlink via NIO.2
|
// create symlink via NIO.2
|
||||||
try {
|
try {
|
||||||
@ -65,7 +65,7 @@ public enum StandardRenameAction implements RenameAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File rename(File from, File to) throws Exception {
|
public File rename(File from, File to) throws Exception {
|
||||||
File destionation = FileUtilities.resolveDestination(from, to);
|
File destionation = FileUtilities.resolveDestination(from, to, true);
|
||||||
|
|
||||||
// create hardlink via NIO.2
|
// create hardlink via NIO.2
|
||||||
try {
|
try {
|
||||||
@ -82,7 +82,7 @@ public enum StandardRenameAction implements RenameAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File rename(File from, File to) throws IOException {
|
public File rename(File from, File to) throws IOException {
|
||||||
return FileUtilities.resolveDestination(from, to);
|
return FileUtilities.resolveDestination(from, to, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ class RenameAction extends AbstractAction {
|
|||||||
|
|
||||||
public static final String RENAME_ACTION = "RENAME_ACTION";
|
public static final String RENAME_ACTION = "RENAME_ACTION";
|
||||||
|
|
||||||
|
|
||||||
private final RenameModel model;
|
private final RenameModel model;
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ class RenameAction extends AbstractAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
if (model.getRenameMap().isEmpty()) {
|
if (model.getRenameMap().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@ -102,7 +104,7 @@ class RenameAction extends AbstractAction {
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
// could not rename one of the files, revert all changes
|
// could not rename one of the files, revert all changes
|
||||||
UILogger.log(Level.WARNING, e.getMessage(), e);
|
UILogger.log(Level.WARNING, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@ -323,7 +325,7 @@ class RenameAction extends AbstractAction {
|
|||||||
super.cancel(false);
|
super.cancel(false);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
// check status of renamed files
|
// check status of renamed files
|
||||||
for (Entry<File, File> it : renameMap.entrySet()) {
|
for (Entry<File, File> it : renameMap.entrySet()) {
|
||||||
if (it.getValue().exists()) {
|
if (it.getValue().exists()) {
|
||||||
renameLog.put(it.getKey(), it.getValue());
|
renameLog.put(it.getKey(), it.getValue());
|
||||||
|
@ -44,7 +44,7 @@ public final class FileUtilities {
|
|||||||
|
|
||||||
public static File moveRename(File source, File destination) throws IOException {
|
public static File moveRename(File source, File destination) throws IOException {
|
||||||
// resolve destination
|
// resolve destination
|
||||||
destination = resolveDestination(source, destination);
|
destination = resolveDestination(source, destination, true);
|
||||||
|
|
||||||
if (source.isDirectory()) {
|
if (source.isDirectory()) {
|
||||||
// move folder
|
// move folder
|
||||||
@ -64,7 +64,7 @@ public final class FileUtilities {
|
|||||||
|
|
||||||
public static File copyAs(File source, File destination) throws IOException {
|
public static File copyAs(File source, File destination) throws IOException {
|
||||||
// resolve destination
|
// resolve destination
|
||||||
destination = resolveDestination(source, destination);
|
destination = resolveDestination(source, destination, true);
|
||||||
|
|
||||||
if (source.isDirectory()) {
|
if (source.isDirectory()) {
|
||||||
// copy folder
|
// copy folder
|
||||||
@ -82,7 +82,7 @@ public final class FileUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static File resolveDestination(File source, File destination) throws IOException {
|
public static File resolveDestination(File source, File destination, boolean mkdirs) throws IOException {
|
||||||
// resolve destination
|
// resolve destination
|
||||||
if (!destination.isAbsolute()) {
|
if (!destination.isAbsolute()) {
|
||||||
// same folder, different name
|
// same folder, different name
|
||||||
@ -93,7 +93,7 @@ public final class FileUtilities {
|
|||||||
File destinationFolder = destination.getParentFile();
|
File destinationFolder = destination.getParentFile();
|
||||||
|
|
||||||
// create parent folder if necessary
|
// create parent folder if necessary
|
||||||
if (!destinationFolder.isDirectory() && !destinationFolder.mkdirs()) {
|
if (mkdirs && !destinationFolder.isDirectory() && !destinationFolder.mkdirs()) {
|
||||||
throw new IOException("Failed to create folder: " + destinationFolder);
|
throw new IOException("Failed to create folder: " + destinationFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ public final class FileUtilities {
|
|||||||
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
|
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
|
||||||
tr.setOutputProperty(OutputKeys.INDENT, "yes");
|
tr.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
|
||||||
//create string from dom
|
// create string from dom
|
||||||
StringWriter buffer = new StringWriter();
|
StringWriter buffer = new StringWriter();
|
||||||
tr.transform(new DOMSource(dom), new StreamResult(buffer));
|
tr.transform(new DOMSource(dom), new StreamResult(buffer));
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
@ -532,6 +532,7 @@ public final class FileUtilities {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public static final FileFilter FILES = new FileFilter() {
|
public static final FileFilter FILES = new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -540,6 +541,7 @@ public final class FileUtilities {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public static final FileFilter TEMPORARY = new FileFilter() {
|
public static final FileFilter TEMPORARY = new FileFilter() {
|
||||||
|
|
||||||
private final String tmpdir = System.getProperty("java.io.tmpdir");
|
private final String tmpdir = System.getProperty("java.io.tmpdir");
|
||||||
|
Loading…
Reference in New Issue
Block a user