mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
When looking for music to play, ignore non-file entities (e.g. .svn directories).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package forge.sound;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.properties.ForgeConstants;
|
||||
@@ -21,7 +22,13 @@ public enum MusicPlaylist {
|
||||
public String getRandomFilename() {
|
||||
if (filenames == null) {
|
||||
try {
|
||||
filenames = new File(ForgeConstants.MUSIC_DIR + subDir).list();
|
||||
FilenameFilter filter = new FilenameFilter(){
|
||||
@Override
|
||||
public boolean accept(File file, String name) {
|
||||
return file.isFile();
|
||||
}
|
||||
};
|
||||
filenames = new File(ForgeConstants.MUSIC_DIR + subDir).list(filter);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user