fix: IllegalArgumentException

This commit is contained in:
huanghongxun
2020-04-29 21:48:21 +08:00
parent 94db91b7c1
commit 8997895a82

View File

@@ -75,7 +75,13 @@ public class FileItem extends BorderPane {
* Converts the given path to absolute/relative(if possible) path according to {@link #convertToRelativePathProperty()}.
*/
private String processPath(String path) {
Path given = Paths.get(path).toAbsolutePath();
Path given;
try {
given = Paths.get(path).toAbsolutePath();
} catch (IllegalArgumentException e) {
return path;
}
if (isConvertToRelativePath()) {
try {
return Paths.get(".").normalize().toAbsolutePath().relativize(given).normalize().toString();