fix: InvalidPathException when custom run directory is not valid
This commit is contained in:
@@ -390,4 +390,19 @@ public final class FileUtils {
|
||||
result.add(it);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether the file is convertible to [java.nio.file.Path] or not.
|
||||
*
|
||||
* @param file the file to be tested
|
||||
* @return true if the file is convertible to Path.
|
||||
*/
|
||||
public static boolean isValidPath(File file) {
|
||||
try {
|
||||
file.toPath();
|
||||
return true;
|
||||
} catch (InvalidPathException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user