mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Cache content after file is written successfully.
This commit is contained in:
@@ -61,8 +61,8 @@ class File
|
||||
# Public: Overwrites the file with the given String.
|
||||
write: (text) ->
|
||||
previouslyExisted = @exists()
|
||||
@cachedContents = text
|
||||
@writeFileWithPrivilegeEscalationSync(@getPath(), text)
|
||||
@cachedContents = text
|
||||
@subscribeToNativeChangeEvents() if not previouslyExisted and @hasSubscriptions()
|
||||
|
||||
# Deprecated
|
||||
@@ -132,7 +132,7 @@ class File
|
||||
fs.writeFileSync(path, text)
|
||||
catch error
|
||||
if error.code is 'EACCES' and process.platform is 'darwin'
|
||||
authopen = '/usr/libexec/authopen' # man 1 auth open
|
||||
authopen = '/usr/libexec/authopen' # man 1 authopen
|
||||
unless runas(authopen, ['-w', '-c', path], stdin: text) is 0
|
||||
throw error
|
||||
else
|
||||
|
||||
@@ -194,8 +194,8 @@ class TextBuffer extends TextBufferCore
|
||||
|
||||
@emit 'will-be-saved', this
|
||||
@setPath(path)
|
||||
@cachedDiskContents = @getText()
|
||||
@file.write(@getText())
|
||||
@cachedDiskContents = @getText()
|
||||
@emitModifiedStatusChanged(false)
|
||||
@emit 'saved', this
|
||||
|
||||
|
||||
Reference in New Issue
Block a user