Skip to content

Commit

Permalink
Merge pull request #115 from trobrock/ignore-hidden-folders
Browse files Browse the repository at this point in the history
Ignore hidden folders
  • Loading branch information
holman committed Mar 30, 2012
2 parents 68a3382 + e95bead commit a4a4a2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/play/library.rb
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion test/library_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit a4a4a2c

Please sign in to comment.