Add option to make temporary file backups when saving

This commit is contained in:
Nathan Sobo
2015-07-29 11:19:16 -06:00
parent e187e4bf53
commit c5bb4a27a5
3 changed files with 7 additions and 3 deletions

View File

@@ -173,6 +173,10 @@ module.exports =
type: 'boolean'
default: true
title: 'Confirm Checkout HEAD Revision'
backUpBeforeSaving:
type: 'boolean'
default: false
description: 'Ensure file contents aren\'t lost if there is an I/O error during save by making a temporary backup copy.'
invisibles:
type: 'object'
properties:

View File

@@ -621,14 +621,14 @@ class TextEditor extends Model
# Essential: Saves the editor's text buffer.
#
# See {TextBuffer::save} for more details.
save: -> @buffer.save()
save: -> @buffer.save(backup: atom.config.get('editor.backUpBeforeSaving'))
# Public: Saves the editor's text buffer as the given path.
#
# See {TextBuffer::saveAs} for more details.
#
# * `filePath` A {String} path.
saveAs: (filePath) -> @buffer.saveAs(filePath)
saveAs: (filePath) -> @buffer.saveAs(filePath, backup: atom.config.get('editor.backUpBeforeSaving'))
# Determine whether the user should be prompted to save before closing
# this editor.