diff --git a/CHANGELOG.md b/CHANGELOG.md index 8606dfa7ed8..a024b2ae4c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where the article title with colon fails to download the arXiv link (pdf file). [#7660](https://github.com/JabRef/issues/7660) - We fixed an issue where the keybinding for delete entry did not work on the main table [7580](https://github.com/JabRef/jabref/pull/7580) - We fixed an issue where the RFC fetcher is not compatible with the draft [7305](https://github.com/JabRef/jabref/issues/7305) +- We fixed an issue where the `Aux file` on `Edit group` doesn't support relative sub-directories path to import. [#7719](https://github.com/JabRef/jabref/issues/7719). ### Removed diff --git a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java index 49becd539d6..11fe996adcd 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java @@ -227,7 +227,7 @@ private void setupValidation() { if (StringUtil.isBlank(input)) { return false; } else { - Path texFilePath = preferencesService.getWorkingDir().resolve(input); + Path texFilePath = getAbsoluteTexGroupPath(input); if (!Files.isRegularFile(texFilePath)) { return false; } @@ -263,6 +263,16 @@ private void setupValidation() { }); } + /** + * gets the absolute path relative to getLatexFileDirectory, if given a relative path + * @param input the user input path + * @return an absolute path + */ + private Path getAbsoluteTexGroupPath(String input) { + Optional latexFileDirectory = currentDatabase.getMetaData().getLatexFileDirectory(preferencesService.getUser()); + return latexFileDirectory.map(path -> path.resolve(input)).orElse(Path.of(input)); + } + public void validationHandler(Event event) { ValidationStatus validationStatus = validator.getValidationStatus(); if (validationStatus.getHighestMessage().isPresent()) { @@ -335,12 +345,10 @@ public AbstractGroup resultConverter(ButtonType button) { FieldFactory.parseField(autoGroupPersonsFieldProperty.getValue().trim())); } } else if (typeTexProperty.getValue()) { - // issue 7719: add workingDir to filepath if it is relative - Path inputPath = preferencesService.getWorkingDir().resolve(Path.of(texGroupFilePathProperty.getValue().trim())); resultingGroup = TexGroup.create( groupName, groupHierarchySelectedProperty.getValue(), - inputPath, + Path.of(texGroupFilePathProperty.getValue().trim()), new DefaultAuxParser(new BibDatabase()), Globals.getFileUpdateMonitor(), currentDatabase.getMetaData()); diff --git a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java index 2a4bc417b51..588e7616b07 100644 --- a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java +++ b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java @@ -87,7 +87,6 @@ private void notifyAboutChange(Path path) { public void addListenerForFile(Path file, FileUpdateListener listener) throws IOException { if (isActive()) { // We can't watch files directly, so monitor their parent directory for updates - // toAbsolutePath() will add the path to Jabref as home directory to file, if file is not a absolute path Path directory = file.toAbsolutePath().getParent(); directory.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY); listeners.put(file, listener);