From 236fd0f414ffc4d17dd392b584ef4826b4935d51 Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 26 Apr 2020 01:58:36 -0400 Subject: Fixed valid directory check --- musicSorter.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'musicSorter.rb') diff --git a/musicSorter.rb b/musicSorter.rb index 30c4f75..7b9a9dc 100644 --- a/musicSorter.rb +++ b/musicSorter.rb @@ -10,8 +10,13 @@ errors = Array.new illegalCharacter = Array['/', '?', '\\', ':', '*', '"', '<', '>', '|'] songsDirectory = ARGV[0]#Where you want your organized songs to end up +if songsDirectory == nil + puts "Invalid Directory Given" + exit(1) +end if !Dir.exist?(songsDirectory) puts "Invalid Directory Given" + exit(1) end #All extensions you want considered and moved @@ -99,3 +104,4 @@ end for error in errors puts error end + -- cgit v1.2.3