summaryrefslogtreecommitdiff
path: root/lib/fileutils.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-10-07 11:26:11 +0200
committergit <svn-admin@ruby-lang.org>2021-10-14 09:12:15 +0900
commitd8d97872a1e0f2785b7666b8efa009a00e237965 (patch)
tree263e73ad6aefa2ec12506663e3282c0667aa59e5 /lib/fileutils.rb
parenta4f2aafd3a9bc2e10fc68558ba1835d7419c4e45 (diff)
downloadruby-d8d97872a1e0f2785b7666b8efa009a00e237965.tar.gz
[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
Diffstat (limited to 'lib/fileutils.rb')
-rw-r--r--lib/fileutils.rb4
1 files changed, 1 insertions, 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
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