01: package abbot.script.parsers;
02:
03: import java.io.File;
04:
05: /** Convert a {@link String} into a {@link java.io.File}. May optionally
06: * provide a file prefix indicating a root directory for relative paths.
07: */
08: public class FileParser implements Parser {
09: public FileParser() {
10: }
11:
12: public Object parse(String input) throws IllegalArgumentException {
13: File file = new File(input);
14: if (!file.isAbsolute()) {
15: file = new File(relativeTo() + File.separator + input);
16: }
17: return file;
18: }
19:
20: public String relativeTo() {
21: return "";
22: }
23: }
|