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