Method: Checker.check_dir
- Defined in:
- lib/youtube_dlhelper/checker.rb
.check_dir(music_dir, folder) ⇒ Object
Checks if the targetdirectory are present. If not, it creates one
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/youtube_dlhelper/checker.rb', line 88 def self.check_dir(music_dir, folder) # @note Checking if musicdir exists if Dir.exist?("#{music_dir}/#{folder}") puts 'Found directory. Im using it.'.colour(:green) else puts 'No directory found. Im creating it.'.colour(:green) # @note Creates the new directory in $music_dir/$folder FileUtils.mkdir_p("#{music_dir}/#{folder}") if Dir.exist?("#{music_dir}/#{folder}") puts 'Created new directory...'.colour(:green) else fail('Cant create directory') end end end |