* fix dnd on mac (and possibly linux)
This commit is contained in:
parent
d982c0a697
commit
c2bfedd978
|
@ -19,9 +19,12 @@ public abstract class FileTransferablePolicy extends TransferablePolicy {
|
|||
try {
|
||||
List<File> files = getFilesFromTransferable(tr);
|
||||
|
||||
if (!containsOnly(files, TEMPORARY)) {
|
||||
return accept(getFilesFromTransferable(tr));
|
||||
// ignore temporary files (may not work on all platforms since the DnD data may not be accessible during the drag)
|
||||
if (files != null && files.size() > 0 && containsOnly(files, TEMPORARY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return accept(files);
|
||||
} catch (UnsupportedFlavorException e) {
|
||||
// no file list flavor
|
||||
}
|
||||
|
|
|
@ -489,12 +489,12 @@ public final class FileUtilities {
|
|||
|
||||
public static final FileFilter TEMPORARY = new FileFilter() {
|
||||
|
||||
private final File TEMP_DIR = new File(System.getProperty("java.io.tmpdir"));
|
||||
private final String tmpdir = System.getProperty("java.io.tmpdir");
|
||||
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.getAbsolutePath().startsWith(TEMP_DIR.getAbsolutePath());
|
||||
return file.getAbsolutePath().startsWith(tmpdir);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue