* avoid potential sandbox permission issues

This commit is contained in:
Reinhard Pointner 2014-08-11 09:55:44 +00:00
parent 3ea880be66
commit e1379dabb3
6 changed files with 19 additions and 9 deletions

View File

@ -301,6 +301,8 @@
<argument value="--log-file" />
<argument value="filebot.log" />
<argument value="--log-lock" />
<argument value="no" />
</bundleapp>
<!-- uses depricated Quicktime API -->

View File

@ -106,7 +106,7 @@ public class DropToUnlock extends JList<File> {
}).filter(f -> f != null && isLockedFolder(f)).sorted().distinct().collect(Collectors.toList());
}
public static boolean showUnlockDialog(Window owner, Collection<File> files) {
public static boolean showUnlockFoldersDialog(Window owner, Collection<File> files) {
final List<File> model = getParentFolders(files);
// immediately return if there is nothing that needs to be unlocked

View File

@ -208,7 +208,7 @@ public class FormatDialog extends JDialog {
public void propertyChange(PropertyChangeEvent evt) {
if (isMacSandbox()) {
if (sample != null && sample.getMediaFile() != null && sample.getMediaFile().exists()) {
DropToUnlock.showUnlockDialog(getWindow(evt.getSource()), singleton(sample.getMediaFile()));
DropToUnlock.showUnlockFoldersDialog(getWindow(evt.getSource()), singleton(sample.getMediaFile()));
}
}
checkFormatInBackground();

View File

@ -533,7 +533,7 @@ class HistoryDialog extends JDialog {
private void rename(File directory, List<Element> elements) {
Map<File, File> renamePlan = getRenameMap(directory);
if (isMacSandbox()) {
if (!DropToUnlock.showUnlockDialog(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) {
if (!DropToUnlock.showUnlockFoldersDialog(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) {
return;
}
}

View File

@ -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.showUnlockDialog(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.getValue(), e.getKey())).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) {
return emptyMap();
}
}

View File

@ -4,6 +4,7 @@ import static java.awt.event.KeyEvent.*;
import static javax.swing.JOptionPane.*;
import static javax.swing.KeyStroke.*;
import static javax.swing.SwingUtilities.*;
import static net.filebot.Settings.*;
import static net.filebot.ui.NotificationLogging.*;
import static net.filebot.util.ExceptionUtilities.*;
import static net.filebot.util.ui.LoadingOverlayPane.*;
@ -54,6 +55,7 @@ import net.filebot.StandardRenameAction;
import net.filebot.UserFiles;
import net.filebot.WebServices;
import net.filebot.format.MediaBindingBean;
import net.filebot.mac.DropToUnlock;
import net.filebot.media.MediaDetection;
import net.filebot.similarity.Match;
import net.filebot.ui.rename.FormatDialog.Mode;
@ -628,12 +630,18 @@ public class RenamePanel extends JComponent {
// clear names list
renameModel.values().clear();
SwingWorker<List<Match<File, ?>>, Void> worker = new SwingWorker<List<Match<File, ?>>, Void>() {
final List<File> remainingFiles = new LinkedList<File>(renameModel.files());
final SortOrder order = SortOrder.forName(persistentPreferredEpisodeOrder.getValue());
final Locale locale = new Locale(persistentPreferredLanguage.getValue());
final boolean autodetection = !isShiftOrAltDown(evt); // skip name auto-detection if SHIFT is pressed
private final List<File> remainingFiles = new LinkedList<File>(renameModel.files());
private final SortOrder order = SortOrder.forName(persistentPreferredEpisodeOrder.getValue());
private final Locale locale = new Locale(persistentPreferredLanguage.getValue());
private final boolean autodetection = !isShiftOrAltDown(evt); // skip name auto-detection if SHIFT is pressed
if (isMacSandbox()) {
if (!DropToUnlock.showUnlockFoldersDialog(getWindow(RenamePanel.this), remainingFiles)) {
return;
}
}
SwingWorker<List<Match<File, ?>>, Void> worker = new SwingWorker<List<Match<File, ?>>, Void>() {
@Override
protected List<Match<File, ?>> doInBackground() throws Exception {