android: GameDatabase: dont add misc extensions from sub folders.
This commit is contained in:
parent
902594d00a
commit
0a2a42f710
@ -141,6 +141,9 @@ public final class GameDatabase extends SQLiteOpenHelper {
|
|||||||
null,
|
null,
|
||||||
null); // Order of folders is irrelevant.
|
null); // Order of folders is irrelevant.
|
||||||
|
|
||||||
|
Set<String> allowedExtensions = new HashSet<String>(Arrays.asList(
|
||||||
|
".3ds", ".3dsx", ".elf", ".axf", ".cci", ".cxi", ".app", ".rar", ".zip", ".7z", ".torrent", ".tar", ".gz"));
|
||||||
|
|
||||||
// Possibly overly defensive, but ensures that moveToNext() does not skip a row.
|
// Possibly overly defensive, but ensures that moveToNext() does not skip a row.
|
||||||
folderCursor.moveToPosition(-1);
|
folderCursor.moveToPosition(-1);
|
||||||
|
|
||||||
@ -170,10 +173,7 @@ public final class GameDatabase extends SQLiteOpenHelper {
|
|||||||
database.close();
|
database.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addGamesRecursive(SQLiteDatabase database, File parent, int depth) {
|
private static void addGamesRecursive(SQLiteDatabase database, File parent, Set<String> allowedExtensions, int depth) {
|
||||||
Set<String> allowedExtensions = new HashSet<String>(Arrays.asList(
|
|
||||||
".3ds", ".3dsx", ".elf", ".axf", ".cci", ".cxi", ".app", ".rar", ".zip", ".7z", ".torrent", ".tar", ".gz"));
|
|
||||||
|
|
||||||
if(depth <= 0) {
|
if(depth <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -186,7 +186,9 @@ public final class GameDatabase extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
addGamesRecursive(database, file, depth - 1);
|
Set<String> newExtensions = new HashSet<>(Arrays.asList(
|
||||||
|
".3ds", ".3dsx", ".elf", ".axf", ".cci", ".cxi", ".app"));
|
||||||
|
addGamesRecursive(database, file, newExtensions, depth - 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String filePath = file.getPath();
|
String filePath = file.getPath();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user