lib/makit/directory.rb in makit-0.0.38 vs lib/makit/directory.rb in makit-0.0.39
- old
+ new
@@ -178,7 +178,23 @@
next if File.directory?(file)
f.puts file.sub("#{dir}/", "")
end
end
end
+
+ def self.remove_empty_directories(dir)
+ Find.find(dir) do |path|
+ if File.directory?(path) && Dir.empty?(path)
+ FileUtils.rm_rf(path)
+ end
+ end
+ end
+
+ def self.remove_empty_directories_recursively(dir)
+ Find.find(dir) do |path|
+ if File.directory?(path) && Dir.empty?(path)
+ FileUtils.rm_rf(path)
+ end
+ end
+ end
end
end