1163: def store_file(path)
1164: if path
1165: data = Editor.model2data(@treeview.model.iter_first)
1166: File.open(path + '.tmp', 'wb') do |output|
1167: if @options_menu.pretty_item.active?
1168: output.puts JSON.pretty_generate(data)
1169: else
1170: output.write JSON.unparse(data)
1171: end
1172: end
1173: File.rename path + '.tmp', path
1174: @filename = path
1175: toplevel.display_status("Saved data to '#@filename'.")
1176: unchange
1177: end
1178: rescue SystemCallError => e
1179: Editor.error_dialog(self, "Failed to store JSON file: #{e}!")
1180: end