mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-15 05:45:05 -05:00
* make sure files are added alphabetically (File.list() does not guarantee sorted return value)
This commit is contained in:
parent
c1d8071844
commit
fc70050ce3
@ -70,7 +70,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<C
|
||||
protected void load(List<File> files, TransferAction action) throws IOException {
|
||||
// initialize drop parameters
|
||||
executor.set(computationService.newExecutor());
|
||||
verificationTracker.set(new VerificationTracker(3));
|
||||
verificationTracker.set(new VerificationTracker(5));
|
||||
|
||||
try {
|
||||
// handle single verification file drop
|
||||
@ -79,7 +79,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<C
|
||||
}
|
||||
// handle single folder drop
|
||||
else if (files.size() == 1 && files.get(0).isDirectory()) {
|
||||
for (File file : getChildren(files.get(0))) {
|
||||
for (File file : getChildren(files.get(0), NOT_HIDDEN, CASE_INSENSITIVE_PATH)) {
|
||||
load(file, null, files.get(0));
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<C
|
||||
|
||||
if (absoluteFile.isDirectory()) {
|
||||
// load all files in the file tree
|
||||
for (File child : getChildren(absoluteFile)) {
|
||||
for (File child : getChildren(absoluteFile, NOT_HIDDEN, CASE_INSENSITIVE_PATH)) {
|
||||
load(child, relativeFile, root);
|
||||
}
|
||||
} else {
|
||||
|
@ -437,22 +437,21 @@ public final class FileUtilities {
|
||||
}
|
||||
|
||||
public static List<File> getChildren(File folder) {
|
||||
File[] files = folder.listFiles();
|
||||
|
||||
// children array may be null if folder permissions do not allow listing of files
|
||||
if (files == null) {
|
||||
files = new File[0];
|
||||
}
|
||||
|
||||
return asList(files);
|
||||
return getChildren(folder, null, null);
|
||||
}
|
||||
|
||||
public static List<File> getChildren(File folder, FileFilter filter) {
|
||||
File[] files = folder.listFiles(filter);
|
||||
return getChildren(folder, filter, null);
|
||||
}
|
||||
|
||||
public static List<File> getChildren(File folder, FileFilter filter, Comparator<File> sorter) {
|
||||
File[] files = filter == null ? folder.listFiles() : folder.listFiles(filter);
|
||||
|
||||
// children array may be null if folder permissions do not allow listing of files
|
||||
if (files == null) {
|
||||
files = new File[0];
|
||||
} else if (sorter != null) {
|
||||
sort(files, sorter);
|
||||
}
|
||||
|
||||
return asList(files);
|
||||
@ -695,6 +694,14 @@ public final class FileUtilities {
|
||||
}
|
||||
};
|
||||
|
||||
public static final FileFilter NOT_HIDDEN = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return !file.isHidden();
|
||||
}
|
||||
};
|
||||
|
||||
public static class ParentFilter implements FileFilter {
|
||||
|
||||
private final File folder;
|
||||
|
Loading…
Reference in New Issue
Block a user