Skip to content

Commit

Permalink
Fixed a bug where the first file in each library directory would be l…
Browse files Browse the repository at this point in the history
…oaded regardless of extension.
  • Loading branch information
crbednarz committed Dec 9, 2013
1 parent 6965760 commit f6f8f53
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/amidst/json/JarLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ public File getFile() {
Log.w("Failed attempt to load library at: " + searchPathFile);
return null;
}

File[] libraryFiles = searchPathFile.listFiles();
if (libraryFiles.length > 0)
file = libraryFiles[0];
else
for (int i = 0; i < libraryFiles.length; i++) {
String extension = "";
String fileName = libraryFiles[i].getName();
int q = fileName.lastIndexOf('.');
if (q > 0)
extension = fileName.substring(q+1);
if (extension.equals("jar"))
file = libraryFiles[i];
}
if (file == null)
Log.w("Attempted to search for file at path: " + searchPath + " but found nothing. Skipping.");
}
return file;
Expand Down

0 comments on commit f6f8f53

Please sign in to comment.