Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Permissions of LaTeXintegration #5134

Merged
merged 4 commits into from
Aug 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.texparser;

import java.io.IOException;
import java.nio.file.FileSystemException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -117,18 +118,26 @@ public void searchButtonClicked() {
noFilesFound.set(true);
searchInProgress.set(true);
successfulSearch.set(false);

})
.onFinished(() -> searchInProgress.set(false))
.onSuccess(newRoot -> {
root.set(newRoot);
noFilesFound.set(false);
successfulSearch.set(true);
})
.onFailure(dialogService::showErrorDialogAndWait)
.onFailure(this::handleFailure)
.executeWith(taskExecutor);
}

private void handleFailure(Exception exception) {
final boolean permissionProblem = exception instanceof IOException && exception.getCause() instanceof FileSystemException && exception.getCause().getMessage().endsWith("Operation not permitted");
if (permissionProblem) {
dialogService.showErrorDialogAndWait(String.format(Localization.lang("JabRef does not have permission to access %s"), exception.getCause().getMessage()));
} else {
dialogService.showErrorDialogAndWait(exception);
}
}

private FileNodeViewModel searchDirectory(Path directory) throws IOException {
if (directory == null || !directory.toFile().exists() || !directory.toFile().isDirectory()) {
throw new IOException("An error occurred while searching an invalid directory.");
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,7 @@ Open\ %0\ file=Open %0 file

Cannot\ delete\ file=Cannot delete file
File\ permission\ error=File permission error
JabRef\ does\ not\ have\ permission\ to\ access\ %s=JabRef does not have permission to access %s
Push\ to\ %0=Push to %0
Path\ to\ %0=Path to %0
Convert=Convert
Expand Down