* resolve relative files properly when asking for folder permissions
This commit is contained in:
parent
c6099ddb58
commit
6499e074f9
|
@ -155,7 +155,7 @@ class RenameAction extends AbstractAction {
|
|||
private Map<File, File> checkRenamePlan(List<Entry<File, File>> renamePlan, Window parent) throws IOException {
|
||||
// ask for user permissions to output paths
|
||||
if (isMacSandbox()) {
|
||||
if (!DropToUnlock.showUnlockFoldersDialog(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getValue(), e.getKey())).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) {
|
||||
if (!DropToUnlock.showUnlockFoldersDialog(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getKey(), resolveDestination(e.getKey(), e.getValue()))).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) {
|
||||
return emptyMap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,16 @@ public final class FileUtilities {
|
|||
return Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING).toFile();
|
||||
}
|
||||
|
||||
public static File resolveDestination(File source, File destination) {
|
||||
// resolve destination
|
||||
if (!destination.isAbsolute()) {
|
||||
// same folder, different name
|
||||
destination = new File(source.getParentFile(), destination.getPath());
|
||||
}
|
||||
|
||||
return destination;
|
||||
}
|
||||
|
||||
public static File resolveDestination(File source, File destination, boolean mkdirs) throws IOException {
|
||||
// resolve destination
|
||||
if (!destination.isAbsolute()) {
|
||||
|
|
Loading…
Reference in New Issue