ruby-changes:68443
From: David <ko1@a...>
Date: Thu, 14 Oct 2021 09:12:42 +0900 (JST)
Subject: [ruby-changes:68443] d8d97872a1 (master): [ruby/fileutils] Simplify loop to find out segments to be created
https://git.ruby-lang.org/ruby.git/commit/?id=d8d97872a1 From d8d97872a1e0f2785b7666b8efa009a00e237965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Thu, 7 Oct 2021 11:26:11 +0200 Subject: [ruby/fileutils] 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. https://github.com/ruby/fileutils/commit/df08e124ce --- lib/fileutils.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 69de458665..7dc46d99e8 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -220,12 +220,10 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L220 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/