return result;
}
+ public static File getBestFile(String[] paths, boolean mustBeJar) {
+ if (null == paths) {
+ return null;
+ }
+ File result = null;
+ for (int i = 0; (null == result) && (i < paths.length); i++) {
+ String path = paths[i];
+ if (null == path) {
+ continue;
+ }
+ if (path.startsWith("sp:")) {
+ try {
+ path = System.getProperty(path.substring(3));
+ } catch (Throwable t) {
+ path = null;
+ }
+ if (null == path) {
+ continue;
+ }
+ }
+ try {
+ File f = new File(path);
+
+ if (f.exists() && f.canRead()) {
+ if (mustBeJar && !f.isDirectory()) {
+ result = FileUtil.getBestFile(f);
+ }
+ }
+ } catch (Throwable t) {
+ // swallow
+ }
+ }
+ return result;
+ }
+
/**
* Render as best file, canonical or absolute.
*