106 // should use the jrt: file system. |
106 // should use the jrt: file system. |
107 // When Locations has been converted to use java.nio.file.Path, |
107 // When Locations has been converted to use java.nio.file.Path, |
108 // Locations can use Paths.get(URI.create("jrt:")) |
108 // Locations can use Paths.get(URI.create("jrt:")) |
109 static final Path JRT_MARKER_FILE = Paths.get("JRT_MARKER_FILE"); |
109 static final Path JRT_MARKER_FILE = Paths.get("JRT_MARKER_FILE"); |
110 |
110 |
111 public Locations() { |
111 Locations() { |
112 initHandlers(); |
112 initHandlers(); |
113 } |
113 } |
114 |
114 |
115 // could replace Lint by "boolean warn" |
115 // could replace Lint by "boolean warn" |
116 public void update(Log log, Lint lint, FSInfo fsInfo) { |
116 void update(Log log, Lint lint, FSInfo fsInfo) { |
117 this.log = log; |
117 this.log = log; |
118 warn = lint.isEnabled(Lint.LintCategory.PATH); |
118 warn = lint.isEnabled(Lint.LintCategory.PATH); |
119 this.fsInfo = fsInfo; |
119 this.fsInfo = fsInfo; |
120 } |
120 } |
121 |
121 |
122 public Collection<Path> bootClassPath() { |
122 boolean isDefaultBootClassPath() { |
123 return getLocation(PLATFORM_CLASS_PATH); |
|
124 } |
|
125 |
|
126 public boolean isDefaultBootClassPath() { |
|
127 BootClassPathLocationHandler h |
123 BootClassPathLocationHandler h |
128 = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH); |
124 = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH); |
129 return h.isDefault(); |
125 return h.isDefault(); |
130 } |
|
131 |
|
132 public Collection<Path> userClassPath() { |
|
133 return getLocation(CLASS_PATH); |
|
134 } |
|
135 |
|
136 public Collection<Path> sourcePath() { |
|
137 Collection<Path> p = getLocation(SOURCE_PATH); |
|
138 // TODO: this should be handled by the LocationHandler |
|
139 return p == null || p.isEmpty() ? null : p; |
|
140 } |
126 } |
141 |
127 |
142 /** |
128 /** |
143 * Split a search path into its elements. Empty path elements will be ignored. |
129 * Split a search path into its elements. Empty path elements will be ignored. |
144 * |
130 * |
751 handlersForOption.put(o, h); |
737 handlersForOption.put(o, h); |
752 } |
738 } |
753 } |
739 } |
754 } |
740 } |
755 |
741 |
756 public boolean handleOption(Option option, String value) { |
742 boolean handleOption(Option option, String value) { |
757 LocationHandler h = handlersForOption.get(option); |
743 LocationHandler h = handlersForOption.get(option); |
758 return (h == null ? false : h.handleOption(option, value)); |
744 return (h == null ? false : h.handleOption(option, value)); |
759 } |
745 } |
760 |
746 |
761 Collection<Path> getLocation(Location location) { |
747 Collection<Path> getLocation(Location location) { |