-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Auto relativize PDF file paths when selecting "Search for unlinked local files" #12088
Changes from 3 commits
d798ddf
eb8722b
4484154
8ea772c
5865d20
3aeecd2
b57bf68
019500f
de348cc
2e01a24
936787f
098c713
ae55866
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,27 @@ public ParserResult importDatabase(Path filePath) throws IOException { | |
return new ParserResult(List.of(entry)); | ||
} | ||
|
||
/** | ||
* A modified version of {@link PdfMergeMetadataImporter#importDatabase(Path)}, but it | ||
* relativizes the {@code filePath} if there are working directories before parsing it | ||
* into {@link PdfMergeMetadataImporter#importDatabase} | ||
* (Otherwise no path modification happens). | ||
* | ||
* @param filePath The unrelativized {@code filePath}. | ||
*/ | ||
public ParserResult importDatabase(Path filePath, BibDatabaseContext context, FilePreferences preferences) throws IOException { | ||
Objects.requireNonNull(context); | ||
Objects.requireNonNull(preferences); | ||
|
||
List<Path> directories = context.getFileDirectories(preferences); | ||
|
||
if (!directories.isEmpty()) { | ||
filePath = FileUtil.relativize(filePath, directories); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't that method also have a check for emptyness? Then, this call can be moved out of the if and the jf be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have just added a commit that does that |
||
} | ||
|
||
return importDatabase(filePath); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "PDF meta data merger"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name the
preferences
variablefilePreferences
- also in the methodimportDatabase