File (@NotNull File file) { File current = file; boolean wcDbFound = false; while (current != null) { File wcDb; if ((wcDb = getWcDb(current)).exists() && ! wcDb.isDirectory()) { wcDbFound = true; break; } current = current.getParentFile(); } if (! wcDbFound) return null; return current; }