@@ -227,22 +227,35 @@ - (NSDictionary*)getAllDBPathsWithDirectories:(NSArray*)directories {
227227 NSMutableDictionary *paths = @{}.mutableCopy ;
228228
229229 for (NSString *directory in directories) {
230- NSArray *dirList = [[[NSFileManager defaultManager ] subpathsAtPath: directory] pathsMatchingExtensions: @[ @" sqlite " , @" SQLITE " , @" db " , @" DB " ]];
230+ NSArray *dirList = [[[NSFileManager defaultManager ] subpathsAtPath: directory] pathsMatchingExtensions: [ self databaseSuffixs ]];
231231
232232 for (NSString *subPath in dirList) {
233- if ([subPath hasSuffix: @" sqlite " ] || [ subPath hasSuffix: @" SQLITE " ]|| [subPath hasSuffix: @" db " ]|| [subPath hasSuffix: @" DB " ]) {
234- [paths setObject: [directory stringByAppendingPathComponent: subPath] forKey: subPath.lastPathComponent];
233+ if ([self checkDatabaseFile: subPath]) {
234+ [paths setObject: [directory stringByAppendingPathComponent: subPath] forKey: subPath.lastPathComponent];
235235 }
236236 }
237237
238- if ([directory hasSuffix: @" sqlite " ] || [ directory hasSuffix: @" SQLITE " ]|| [directory hasSuffix: @" db " ]|| [directory hasSuffix: @" DB " ]) {
238+ if ([self checkDatabaseFile: directory]) {
239239 [paths setObject: directory forKey: directory.lastPathComponent];
240240 }
241241 }
242242
243243 return paths;
244244}
245245
246+ - (BOOL )checkDatabaseFile : (NSString *)fileName {
247+ for (NSString *suffix in [self databaseSuffixs ]) {
248+ if ([fileName hasSuffix: suffix]) {
249+ return YES ;
250+ }
251+ }
252+ return NO ;
253+ }
254+
255+ - (NSArray *)databaseSuffixs {
256+ return @[@" sqlite" , @" SQLITE" , @" db" , @" DB" , @" sqlite3" , @" SQLITE3" ];
257+ }
258+
246259- (NSString *)getTableNameFromQuery : (NSString *)query {
247260 NSArray *words = [query componentsSeparatedByString: @" " ];
248261 NSString *operator = [[words firstObject ] lowercaseString ];
0 commit comments