# File lib/json/editor.rb, line 1226
1226:       def store_file(path)
1227:         if path
1228:           data = Editor.model2data(@treeview.model.iter_first)
1229:           File.open(path + '.tmp', 'wb') do |output|
1230:             data or break
1231:             if @options_menu.pretty_item.active?
1232:               output.puts JSON.pretty_generate(data, :max_nesting => false)
1233:             else
1234:               output.write JSON.generate(data, :max_nesting => false)
1235:             end
1236:           end
1237:           File.rename path + '.tmp', path
1238:           @filename = path
1239:           toplevel.display_status("Saved data to '#@filename'.")
1240:           unchange
1241:         end
1242:       rescue SystemCallError => e
1243:         Editor.error_dialog(self, "Failed to store JSON file: #{e}!")
1244:       end