mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-25 22:18:48 -04:00
file locator detects multiple file matches
This commit is contained in:
parent
b60bf7d807
commit
e5383ee30b
@ -78,7 +78,10 @@ public class FileLocator {
|
||||
* @return this for chained calls
|
||||
*/
|
||||
public FileLocator setLibraryRoot(File libraryRoot) {
|
||||
this.libraryRoot = libraryRoot;
|
||||
if (libraryRoot.isFile())
|
||||
this.libraryRoot = libraryRoot.getParentFile();
|
||||
else
|
||||
this.libraryRoot = libraryRoot;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -156,9 +159,6 @@ public class FileLocator {
|
||||
}
|
||||
|
||||
private int search(File path, ArrayList<File> foundFiles, int fileCounter) throws IOException {
|
||||
if (fileCounter < 0)
|
||||
throw new IOException("to many files");
|
||||
|
||||
File[] list = path.listFiles();
|
||||
if (list != null) {
|
||||
for (File f : list) {
|
||||
@ -168,6 +168,8 @@ public class FileLocator {
|
||||
throw new IOException("multiple matching files: " + foundFiles);
|
||||
}
|
||||
fileCounter--;
|
||||
if (fileCounter < 0)
|
||||
throw new IOException("to many files");
|
||||
}
|
||||
for (File f : list)
|
||||
if (f.isDirectory() && !f.getName().startsWith("."))
|
||||
|
Loading…
x
Reference in New Issue
Block a user