* bug fix for when listFiles returns null for folders due to permission issues
This commit is contained in:
parent
7cb21d824a
commit
5391bdd810
|
@ -180,19 +180,26 @@ public class ReleaseInfo {
|
|||
// Windows / Linux / Mac system roots
|
||||
addAll(volumes, File.listRoots());
|
||||
|
||||
// media root folders
|
||||
if (File.separator.equals("/")) {
|
||||
// Linux and Mac
|
||||
// Linux and Mac system root folders
|
||||
for (File root : File.listRoots()) {
|
||||
addAll(volumes, root.listFiles(FOLDERS));
|
||||
File[] f = root.listFiles(FOLDERS);
|
||||
if (f != null) {
|
||||
addAll(volumes, f);
|
||||
}
|
||||
for (String path : asList("/Volumes", "/home", "/media", "/mnt")) {
|
||||
File root = new File(path);
|
||||
}
|
||||
|
||||
// user-specific media roots
|
||||
for (File root : getMediaRoots()) {
|
||||
if (root.isDirectory()) {
|
||||
addAll(volumes, root.listFiles(FOLDERS));
|
||||
File[] f = root.listFiles(FOLDERS);
|
||||
if (f != null) {
|
||||
addAll(volumes, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volumeRoots = unmodifiableSet(volumes);
|
||||
}
|
||||
return volumeRoots;
|
||||
|
@ -299,6 +306,14 @@ public class ReleaseInfo {
|
|||
return new ClutterFileFilter(getExcludePattern(), Long.parseLong(getBundle(getClass().getName()).getString("number.clutter.maxfilesize"))); // only files smaller than 250 MB may be considered clutter
|
||||
}
|
||||
|
||||
public List<File> getMediaRoots() {
|
||||
List<File> roots = new ArrayList<File>();
|
||||
for (String it : getBundle(getClass().getName()).getString("folder.media.roots").split(":")) {
|
||||
roots.add(new File(it));
|
||||
}
|
||||
return roots;
|
||||
}
|
||||
|
||||
// fetch release group names online and try to update the data every other day
|
||||
protected final CachedResource<String[]> releaseGroupResource = new PatternResource(getBundle(getClass().getName()).getString("url.release-groups"));
|
||||
protected final CachedResource<String[]> queryBlacklistResource = new PatternResource(getBundle(getClass().getName()).getString("url.query-blacklist"));
|
||||
|
|
|
@ -30,3 +30,6 @@ url.anidb-index: http://filebot.net/data/anidb.txt.xz
|
|||
|
||||
# disk folder matcher
|
||||
pattern.diskfolder.entry: BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|movie.nfo
|
||||
|
||||
# media root folders
|
||||
folder.media.roots: /Volumes:/home:/mnt:/media:/share
|
Loading…
Reference in New Issue