Read available worlds file (legacy)
(File historyFile)
| 292 | * Read available worlds file (legacy) |
| 293 | */ |
| 294 | @Deprecated |
| 295 | private static void readWorldList(File historyFile){ |
| 296 | try { |
| 297 | // read from available worlds file |
| 298 | BufferedReader reader = new BufferedReader(new FileReader(historyFile)); |
| 299 | |
| 300 | String line; |
| 301 | while((line = reader.readLine()) != null){ |
| 302 | line = line.trim(); |
| 303 | if(line.startsWith("f ")){ // world file entry |
| 304 | String fileName = line.substring(2).trim(); |
| 305 | |
| 306 | WorldFileDefault worldFile = new WorldFileDefault(fileName); |
| 307 | if(worldFile.canRead()){ // is world file |
| 308 | String name; |
| 309 | try { |
| 310 | // get world name |
| 311 | name = worldFile.readWorldName(); |
| 312 | } catch (Exception ex) { |
| 313 | Logger.getLogger(WorldManager.class.getName()).log(Level.SEVERE, null, ex); |
| 314 | // use file name if world name not found |
| 315 | name = fileName.substring(fileName.lastIndexOf('/') + 1); |
| 316 | } |
| 317 | // add found world to list |
| 318 | push(new WorldFileEntry(name, new File(fileName))); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | } catch (FileNotFoundException ex) {} catch (IOException ex) { |
| 323 | Logger.getLogger(WorldManager.class.getName()).log(Level.SEVERE, null, ex); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | public static class WorldFileEntry { |
| 328 |
no test coverage detected