Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,11 @@ def mkdir_p(list, mode: nil, noop: nil, verbose: nil)
list.each do |item|
path = remove_trailing_slash(item)

# optimize for the most common case
begin
fu_mkdir path, mode
next
rescue SystemCallError
next if File.directory?(path)
end

stack = []
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
until File.directory?(path)
stack.push path
path = File.dirname(path)
break if File.directory?(path)
end
stack.pop if path == stack.last # root directory should exist
stack.reverse_each do |dir|
begin
fu_mkdir dir, mode
Expand Down