public class SourceLocator extends AbstractCommand
name
.tex in the CZT sources,
then searches for a variety of file extensions in the directory
specified by czt.path.Modifier and Type | Class and Description |
---|---|
static class |
SourceLocator.SourceLocatorException
Exception thrown when source could not be found.
|
Modifier and Type | Field and Description |
---|---|
static String |
PROP_CZT_PATH |
Constructor and Description |
---|
SourceLocator() |
Modifier and Type | Method and Description |
---|---|
static void |
addCZTPathFor(File file,
SectionManager manager) |
protected boolean |
doCompute(String name,
SectionManager manager)
Tries to locate the resource named for the given section manager.
|
static String |
extractPath(String filename)
For a file "./dir/foo.ext" or ".\dir\foo.ext", extracts
the path such that the result is "./dir/".
|
static String |
getCZTPathFor(File file,
SectionManager manager) |
static String |
getFileNameNoExt(String filename)
For a file "./dir/foo.ext", returns "./dir/foo".
|
static String |
getSourceName(String filename)
Get the CZT Source name from a given file.
|
protected URL |
locateToolkit(String name)
Locates the given name as a toolkit within CZT.jar /lib/name.tex
|
protected URL |
locateToolkitForClass(Class<?> sourceClass,
String name) |
static List<String> |
processCZTPaths(String path)
Very simple path splitting through
path.split(File.pathSeparator) . |
static String |
removePath(String filename)
For a file "./dir/foo.ext" or ".\dir\foo.ext", removes
the path such that the result is "foo.ext".
|
static Properties |
retrieveCZTProperties(Dialect d)
Retrieve the czt.properties file within user.dir or "."
|
compute, processProperties, traceInfo, traceLog
public static final String PROP_CZT_PATH
protected URL locateToolkit(String name)
name
- protected boolean doCompute(String name, SectionManager manager) throws CommandException
SectionManager
properties:
SourceLocatorException
is raised with the latest calculated
path and the name as additional information. Note that czt.path
can be a semicolon-separated list of paths looked in FIFO order. That means,
if a file is found at an earlier directory, that is the one used.doCompute
in class AbstractCommand
name
- the resource we are trying to locate.manager
- the manager requesting the resource.CommandException
- if resource not found.public static Properties retrieveCZTProperties(Dialect d) throws CommandException
CommandException
- if czt.properties cannot be processedpublic static List<String> processCZTPaths(String path)
path.split(File.pathSeparator)
.
Any more complicated behaviour can be defined differently elsewhere.path
- the string to split, it expects the path to be non-null and non-emptypublic static String removePath(String filename)
filename
- full file name to remove pathpublic static String extractPath(String filename)
filename
- full file name to remove pathpublic static String getFileNameNoExt(String filename)
filename
- full file name to remove extensionpublic static String getSourceName(String filename)
filename
- public static String getCZTPathFor(File file, SectionManager manager)
public static void addCZTPathFor(File file, SectionManager manager)
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.