Class: LgPodPlugin::LFileManager

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

Class Method Summary collapse

Class Method Details

.cache_directorObject



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

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

.cache_workspace(root) ⇒ Object

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



19
20
21
22
23
24
# File 'lib/lg_pod_plugin/utils/file_path.rb', line 19

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

.download_directorObject

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



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

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