(String path)
| 203 | } |
| 204 | |
| 205 | public FileHandle getFile(String path) { |
| 206 | if (Cache.containsKey(path)) return Cache.get(path); |
| 207 | |
| 208 | //if (Cache.containsKey(commonPath)) return Cache.get(commonPath); |
| 209 | |
| 210 | //not cached, look for resource |
| 211 | System.out.print("Looking for resource " + path + "... "); |
| 212 | String fullPath = (prefix + path).replace("//", "/"); |
| 213 | String fileName = fullPath.replaceFirst("[.][^.]+$", ""); |
| 214 | String ext = fullPath.substring(fullPath.lastIndexOf('.')); |
| 215 | String langFile = fileName + "-" + Lang + ext; |
| 216 | |
| 217 | for (int iter = 1; iter <= 2; iter++) { |
| 218 | |
| 219 | if (Files.exists(Paths.get(langFile))) { |
| 220 | System.out.println("Found!"); |
| 221 | Cache.put(path, new FileHandle(langFile)); |
| 222 | break; |
| 223 | } else if (Files.exists(Paths.get(fullPath))) { |
| 224 | System.out.println("Found!"); |
| 225 | Cache.put(path, new FileHandle(fullPath)); |
| 226 | break; |
| 227 | } |
| 228 | //no local resource, check common resources |
| 229 | fullPath = (commonPrefix + path).replace("//", "/"); |
| 230 | fileName = fullPath.replaceFirst("[.][^.]+$", ""); |
| 231 | langFile = fileName + "-" + Lang + ext; |
| 232 | } |
| 233 | return Cache.get(path); |
| 234 | } |
| 235 | |
| 236 | public String getPlane() { |
| 237 | return plane.replace("<user>", "user_"); |
no test coverage detected