do not index hidden files or folders.
This commit is contained in:
parent
e3b878e69b
commit
c6fedb9e17
@ -426,6 +426,9 @@ public class MediaScanner implements Handler.Callback {
|
||||
if (new File(dir, ".nomedia").exists())
|
||||
return;
|
||||
|
||||
if (isDotfile(dir))
|
||||
return;
|
||||
|
||||
File[] dirents = dir.listFiles();
|
||||
if (dirents == null)
|
||||
return;
|
||||
@ -450,6 +453,9 @@ public class MediaScanner implements Handler.Callback {
|
||||
if (isBlacklisted(file))
|
||||
return false;
|
||||
|
||||
if (isDotfile(file))
|
||||
return false;
|
||||
|
||||
long dbEntryMtime = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.MTIME, songId) * 1000; // this is in unixtime -> convert to 'ms'
|
||||
long songFlags = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.FLAGS, songId);
|
||||
long fileMtime = file.lastModified();
|
||||
@ -646,6 +652,17 @@ public class MediaScanner implements Handler.Callback {
|
||||
}
|
||||
|
||||
|
||||
private static final Pattern sDotfilePattern = Pattern.compile("^\\..*$", Pattern.CASE_INSENSITIVE);
|
||||
/**
|
||||
* Returns true if the file is a hidden dotfile.
|
||||
*
|
||||
* @param file to inspect
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isDotfile(File file) {
|
||||
return sDotfilePattern.matcher(file.getName()).matches();
|
||||
}
|
||||
|
||||
// MediaScanPlan describes how we are going to perform the media scan
|
||||
class MediaScanPlan {
|
||||
class Step {
|
||||
|
Loading…
x
Reference in New Issue
Block a user