commit 56e1e7d653d3cf0a486124c65b4058791e00b99f
parent 2fa134eda1b91f679858f5a540d41cde7c004284
Author: lostd <lostd@2f30.org>
Date: Tue, 14 Aug 2012 11:46:47 +0000
Exit early if no music files in cwd
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bin/musicfix b/bin/musicfix
@@ -122,6 +122,10 @@ tracks = ARGV[1] || nil
# Construct file list
fl = Dir['*'].select {|f| File.extname(f).match /mp3|ogg|mpc|flac|wv/i}.sort
+if fl.empty? then
+ puts 'No music files found!'
+ exit
+end
puts 'Files to process:'
puts fl
@@ -142,7 +146,6 @@ end
# Sanity checks
if tl.length != fl.length then
puts "Found #{tl.length} tracks for #{fl.length} music files."
- exit if fl.length == 0
if fl.length < tl.length then
print "Use only the first #{fl.length} entries? [N/y] "
else