diff --git a/lib/play/library.rb b/lib/play/library.rb index 5fe77e34..55baa075 100644 --- a/lib/play/library.rb +++ b/lib/play/library.rb @@ -17,7 +17,7 @@ def self.monitor # # Returns an Array of String file paths. def self.fs_songs(path) - `find -L "#{path}" -type f ! -name '.*'`.split("\n") + `find -L "#{path}" -type f ! -path '#{path}/.*' ! -name '.*'`.split("\n") end # Imports an array of songs into the database. diff --git a/test/library_test.rb b/test/library_test.rb index 1980e63b..c9f1f041 100644 --- a/test/library_test.rb +++ b/test/library_test.rb @@ -5,7 +5,9 @@ end test "fs_songs" do - FileUtils.mkdir_p '/tmp/play' + FileUtils.mkdir_p '/tmp/play/.hidden' + FileUtils.touch '/tmp/play/.hidden/song_1' + FileUtils.touch '/tmp/play/.song_1' FileUtils.touch '/tmp/play/song_1' FileUtils.touch '/tmp/play/song_2' assert_equal 2, Library.fs_songs('/tmp/play').size