Method: Util#write_file
- Defined in:
- lib/util.rb
#write_file(file, content) ⇒ Object
操作 ####################
87 88 89 90 91 92 93 94 |
# File 'lib/util.rb', line 87 def write_file(file, content) dir = File::dirname file #如果不在存文件夹, 则先创建 # puts dir FileUtils.mkpath(dir) if not File::exists?(dir) #写入文件 IO.write(file, content, :encoding => 'utf-8') end |