Class: Dir
- Inherits:
-
Object
- Object
- Dir
- Defined in:
- lib/cocoapods-bb-PodAssistant/source_provider_hook.rb
Class Method Summary collapse
Class Method Details
.size(dir) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cocoapods-bb-PodAssistant/source_provider_hook.rb', line 7 def self.size(dir) sum = 0 Dir.foreach(dir) do |entry| begin next if entry =~ /^\./ && entry != '.git' next if entry == "lfs" # 不统计在lfs文件夹下的资源,git clone下载的是lfs内的资源,之后copy到真正目录下,导致大小统计了两次,所以这里不统计lfs目录下的资源 path = File.join(dir, entry) FileTest.directory?(path) ? sum += Dir.size(path) : sum += File.size(path) rescue => exception # puts "[PodAssistant] Dir.size error(已捕获): #{exception}" next retry end end sum end |