Skip to content

Commit df08e12

Browse files
Simplify loop to find out segments to be created
Doing it this way is simpler and it doesn't end up adding "/" to the list of folders, so it doesn't need to be removed later.
1 parent 3223c40 commit df08e12

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/fileutils.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,10 @@ def mkdir_p(list, mode: nil, noop: nil, verbose: nil)
220220
end
221221

222222
stack = []
223-
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
223+
until File.directory?(path)
224224
stack.push path
225225
path = File.dirname(path)
226-
break if File.directory?(path)
227226
end
228-
stack.pop if path == stack.last # root directory should exist
229227
stack.reverse_each do |dir|
230228
begin
231229
fu_mkdir dir, mode

0 commit comments

Comments
 (0)