Class: LgPodPlugin::LFileManager

Inherits:
Object
  • Object
show all
Defined in:
lib/lg_pod_plugin/file_path.rb

Class Method Summary collapse

Class Method Details

.cache_directorObject



6
7
8
# File 'lib/lg_pod_plugin/file_path.rb', line 6

def self.cache_director
  Pathname(File.join(Dir.home, "Library/Caches"))
end

.cache_workspace(root) ⇒ Object

pod缓存工作目录, 根据项目所在路径计算所得 确保唯一



21
22
23
24
25
26
# File 'lib/lg_pod_plugin/file_path.rb', line 21

def self.cache_workspace(root)
  timestamp = "_#{Time.now.to_i}_"
  key = root.to_path + timestamp + "#{(rand * 10000000).to_i}"
  director = Digest::MD5.hexdigest(key)
  return self.download_director.join(director)
end

.download_directorObject

本地下载路径 ~Library/Caches/LgPodPlugin



11
12
13
14
15
16
17
18
# File 'lib/lg_pod_plugin/file_path.rb', line 11

def self.download_director
  cache_path = self.cache_director.join("LgPodPlugin")
  unless cache_path.exist?
    # pp "文件路径不存在"
    cache_path.mkdir(0700)
  end
  cache_path
end