mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Use the wx flag to atomically create a config file if it doesn't exist
This commit is contained in:
@@ -862,11 +862,8 @@ class Config
|
||||
|
||||
console.log 'loadUserConfig'
|
||||
try
|
||||
# fs.makeTreeSync(path.dirname(@configFilePath))
|
||||
# CSON.writeFileSync(@configFilePath, {flag: 'x'}, {}) # fails if file exists
|
||||
unless fs.existsSync(@configFilePath)
|
||||
fs.makeTreeSync(path.dirname(@configFilePath))
|
||||
CSON.writeFileSync(@configFilePath, {})
|
||||
fs.makeTreeSync(path.dirname(@configFilePath))
|
||||
CSON.writeFileSync(@configFilePath, {}, {flag: 'wx'}) # fails if file exists
|
||||
catch error
|
||||
@configFileHasErrors = true
|
||||
@notifyFailure("Failed to initialize `#{path.basename(@configFilePath)}`", error.stack)
|
||||
|
||||
Reference in New Issue
Block a user