Skip to content

Commit

Permalink
修复文件未正确关闭的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jitingcn committed Oct 12, 2023
1 parent a19b7d0 commit ff88e9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@
end

# save to new file
file = File.open("src/lagos_zh.ts", "wb")
zh_doc.write_xml_to(
File.open("src/lagos_zh.ts", "wb"),
file,
indent: 4,
save_with: Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS | Nokogiri::XML::Node::SaveOptions::FORMAT
)
file.flush
file.close

# remove 4 space indent for every line between tag TS
File.write("src/lagos_zh.ts", File.read("src/lagos_zh.ts").gsub(/\n {4}/, "\n"))
Expand Down

0 comments on commit ff88e9a

Please sign in to comment.