public final class AppUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Map<String,URL> |
findResources(String regex,
Iterable<URL> urls)
Finds
URL s of resources known to ImageJ. |
static Map<String,URL> |
findResources(String regex,
String pathPrefix)
Finds
URL s of resources known to ImageJ. |
static File |
getBaseDirectory()
Deprecated.
Use
App.getBaseDirectory() instead. |
@Deprecated public static File getBaseDirectory()
App.getBaseDirectory()
instead.ij.dir
property is set, it
is used. Otherwise, we scan up the tree from this class for a suitable
directory.public static Map<String,URL> findResources(String regex, String pathPrefix)
URL
s of resources known to ImageJ. Both JAR files and files
on disk are searched, according to the following mechanism:
pathPrefix
are discovered using
ClassLoader.getResources(String)
with the current thread's context
class loader. In particular, this invocation discovers resources in JAR
files beneath the given pathPrefix
.pathPrefix
beneath the
ImageJ application base directory
.
In both cases, resources are then recursively scanned using SciJava
Common's FileUtils.listContents(URL)
, and anything matching the
given regex
pattern is added to the output map.
Note that the pathPrefix
directory is scanned after the
URL resources, so that users can more easily override resources provided
inside JAR files by placing a resource of the same name within the
pathPrefix
directory.
regex
- The regex to use when matching resources, or null to match
everything.pathPrefix
- The path to search for resources.public static Map<String,URL> findResources(String regex, Iterable<URL> urls)
URL
s of resources known to ImageJ.
Each of the given URL
s is recursively scanned using SciJava
Common's FileUtils.listContents(URL)
, and anything matching the
given regex
pattern is added to the output map.
regex
- The regex to use when matching resources, or null to match
everything.urls
- Paths to search for resources.Copyright © 2014–2022 ImageJ. All rights reserved.