|
3 | 3 | import java.io.File; |
4 | 4 | import java.io.IOException; |
5 | 5 | import java.nio.file.Path; |
6 | | -import java.nio.file.Paths; |
7 | 6 | import java.util.ArrayList; |
8 | 7 | import java.util.Collections; |
9 | 8 | import java.util.List; |
@@ -111,9 +110,9 @@ private static Optional<ParserResult> importFile(String argument) { |
111 | 110 | } |
112 | 111 | } else { |
113 | 112 | if (OS.WINDOWS) { |
114 | | - file = Paths.get(address); |
| 113 | + file = Path.of(address); |
115 | 114 | } else { |
116 | | - file = Paths.get(address.replace("~", System.getProperty("user.home"))); |
| 115 | + file = Path.of(address.replace("~", System.getProperty("user.home"))); |
117 | 116 | } |
118 | 117 | } |
119 | 118 |
|
@@ -280,7 +279,7 @@ private boolean exportMatches(List<ParserResult> loaded) { |
280 | 279 | // We have an TemplateExporter instance: |
281 | 280 | try { |
282 | 281 | System.out.println(Localization.lang("Exporting") + ": " + data[1]); |
283 | | - exporter.get().export(databaseContext, Paths.get(data[1]), |
| 282 | + exporter.get().export(databaseContext, Path.of(data[1]), |
284 | 283 | databaseContext.getMetaData().getEncoding().orElse(Globals.prefs.getDefaultEncoding()), |
285 | 284 | matches); |
286 | 285 | } catch (Exception ex) { |
@@ -389,7 +388,7 @@ private void saveDatabase(BibDatabase newBase, String subName) { |
389 | 388 | try { |
390 | 389 | System.out.println(Localization.lang("Saving") + ": " + subName); |
391 | 390 | SavePreferences prefs = Globals.prefs.loadForSaveFromPreferences(); |
392 | | - AtomicFileWriter fileWriter = new AtomicFileWriter(Paths.get(subName), prefs.getEncoding()); |
| 391 | + AtomicFileWriter fileWriter = new AtomicFileWriter(Path.of(subName), prefs.getEncoding()); |
393 | 392 | BibDatabaseWriter databaseWriter = new BibtexDatabaseWriter(fileWriter, prefs, Globals.entryTypesManager); |
394 | 393 | databaseWriter.saveDatabase(new BibDatabaseContext(newBase)); |
395 | 394 |
|
@@ -441,7 +440,7 @@ private void exportFile(List<ParserResult> loaded, String[] data) { |
441 | 440 | } else { |
442 | 441 | // We have an exporter: |
443 | 442 | try { |
444 | | - exporter.get().export(pr.getDatabaseContext(), Paths.get(data[0]), |
| 443 | + exporter.get().export(pr.getDatabaseContext(), Path.of(data[0]), |
445 | 444 | pr.getDatabaseContext().getMetaData().getEncoding() |
446 | 445 | .orElse(Globals.prefs.getDefaultEncoding()), |
447 | 446 | pr.getDatabaseContext().getDatabase().getEntries()); |
|
0 commit comments