/** Traverses a fake file folder structure indicated by traversedDirectory */ private List<String> listFakeSeries(String traversedDirectory) { File parent = new File(traversedDirectory); if (parent.isDirectory()) { File[] children = parent.listFiles(); Arrays.sort(children); if (children != null) { for (File child : children) { listFakeSeries(child.getAbsolutePath()); } } } else { String path = parent.getAbsolutePath(); // explicitly check suffixes, otherwise any other files that were put // in the directory will be picked up (e.g. .DS_Store) if (checkSuffix(path, "fake") || checkSuffix(path, "fake.ini")) { fakeSeries.add(path); } } return fakeSeries; }
/** Traverses a fake file folder structure indicated by traversedDirectory */ private List<String> listFakeSeries(String traversedDirectory) { File parent = new File(traversedDirectory); if (parent.isDirectory()) { File[] children = parent.listFiles(); Arrays.sort(children); if (children != null) { for (File child : children) { listFakeSeries(child.getAbsolutePath()); } } } else { String path = parent.getAbsolutePath(); // explicitly check suffixes, otherwise any other files that were put // in the directory will be picked up (e.g. .DS_Store) if (checkSuffix(path, "fake") || checkSuffix(path, "fake.ini")) { fakeSeries.add(path); } } return fakeSeries; }
@Override public boolean isThisType(String name, boolean open) { if (checkSuffix(name, "fake.ini")) { return true; } fakeSeries.clear(); if (name.endsWith(".fake") && listFakeSeries(name).size() > 0) { return true; } return super.isThisType(name, open); }
@Override public boolean isThisType(String name, boolean open) { if (checkSuffix(name, "fake.ini")) { return true; } fakeSeries.clear(); if (name.endsWith(".fake") && listFakeSeries(name).size() > 0) { return true; } return super.isThisType(name, open); }
@Override public boolean isSingleFile(String id) throws FormatException, IOException { if (new Location(id).isDirectory() && checkSuffix(id, "fake")) { fakeSeries.clear(); return listFakeSeries(id).size() <= 1; } if (checkSuffix(id, "fake" + ".ini")) { return ! new Location(id).exists(); } return ! new Location(id + ".ini").exists(); }
@Override public boolean isSingleFile(String id) throws FormatException, IOException { if (new Location(id).isDirectory() && checkSuffix(id, "fake")) { fakeSeries.clear(); return listFakeSeries(id).size() <= 1; } if (checkSuffix(id, "fake" + ".ini")) { return ! new Location(id).exists(); } return ! new Location(id + ".ini").exists(); }
@Override protected void initFile(String id) throws FormatException, IOException { if (!checkSuffix(id, "fake")) { if (checkSuffix(id, "fake.ini")) { id = id.substring(0, id.lastIndexOf(".")); name = name.substring(0, name.lastIndexOf(".")); for (String f : list) { if (checkSuffix(f, "fake") && f.startsWith(name)) { id = new Location(dir, f).getAbsolutePath(); break;
@Override protected void initFile(String id) throws FormatException, IOException { if (!checkSuffix(id, "fake")) { if (checkSuffix(id, "fake.ini")) { id = id.substring(0, id.lastIndexOf(".")); name = name.substring(0, name.lastIndexOf(".")); for (String f : list) { if (checkSuffix(f, "fake") && f.startsWith(name)) { id = new Location(dir, f).getAbsolutePath(); break;