Comparar commits
27 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 9105348c8c | |||
| 30419027a8 | |||
| 5de95759cd | |||
| f7502d8508 | |||
| c9f13afb72 | |||
| e51c8f3407 | |||
| 63ee46023d | |||
| 68e5839b14 | |||
| 477801ba52 | |||
| 3850550345 | |||
| 728a8049d9 | |||
| 77741b6f3f | |||
| 4597dd5594 | |||
| 04d015a7e0 | |||
| 4bd07be7d8 | |||
| 40de6a7114 | |||
| 9100d20dc4 | |||
| 4361b67214 | |||
| 83c8d904cf | |||
| 3257d17fc0 | |||
| fd1d872840 | |||
| c5b6b90c88 | |||
| 9618ec45cf | |||
| 6e3d41f433 | |||
| 6f438ca7da | |||
| c629eb73b2 | |||
| cbe5eff04c |
+2
-12
@@ -24,18 +24,8 @@ Atom will automatically update when a new release is available.
|
||||
You can also download an `atom-windows.zip` file from the [releases page](https://github.com/atom/atom/releases/latest).
|
||||
The `.zip` version will not automatically update.
|
||||
|
||||
#### Uninstalling Chocolatey Version
|
||||
|
||||
The recommended installation of Atom on Windows used to be using [Chocolatey](https://chocolatey.org/packages/Atom/).
|
||||
This is no longer recommended now that the Atom Windows installer & auto-updater
|
||||
exists.
|
||||
|
||||
To switch from Chocolatey to the new installer:
|
||||
* Upgrade to Atom 0.155 or above by running `cup Atom`
|
||||
* Run `cuninst Atom` to uninstall the Chocolatey version of Atom
|
||||
* This will not delete any of your installed packages or Atom config files.
|
||||
* Download the latest [AtomSetup.exe installer](https://github.com/atom/atom/releases/latest).
|
||||
* Double-click the downloaded file to install Atom
|
||||
Using [chocolatey](https://chocolatey.org/)? Run `cinst Atom` to install
|
||||
the latest version of Atom.
|
||||
|
||||
### Debian Linux (Ubuntu)
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ module.exports = (grunt) ->
|
||||
|
||||
{description} = grunt.file.readJSON('package.json')
|
||||
iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png')
|
||||
installDir = path.join(installDir, '.') # To prevent "Exec=/usr/local//share/atom/atom"
|
||||
executable = path.join(shareDir, 'atom')
|
||||
template = _.template(String(fs.readFileSync(desktopFile)))
|
||||
filled = template({description, installDir, iconName})
|
||||
filled = template({description, iconName, executable})
|
||||
|
||||
grunt.file.write(desktopInstallFile, filled)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ When you are deprecation free and all done converting, upgrade the `engines` fie
|
||||
```json
|
||||
{
|
||||
"engines": {
|
||||
"atom": ">=0.174.0, <2.0.0"
|
||||
"atom": ">=0.174.0 <2.0.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
+4
-3
@@ -31,7 +31,7 @@
|
||||
"emissary": "^1.3.1",
|
||||
"event-kit": "^1.0.2",
|
||||
"first-mate": "^3.0.0",
|
||||
"fs-plus": "^2.3.2",
|
||||
"fs-plus": "^2.5",
|
||||
"fstream": "0.1.24",
|
||||
"fuzzaldrin": "^2.1",
|
||||
"git-utils": "^3.0.0",
|
||||
@@ -103,7 +103,7 @@
|
||||
"incompatible-packages": "0.21.0",
|
||||
"keybinding-resolver": "0.27.0",
|
||||
"link": "0.30.0",
|
||||
"markdown-preview": "0.133.0",
|
||||
"markdown-preview": "0.134.0",
|
||||
"metrics": "0.42.0",
|
||||
"notifications": "0.26.0",
|
||||
"open-on-github": "0.32.0",
|
||||
@@ -116,7 +116,7 @@
|
||||
"styleguide": "0.43.0",
|
||||
"symbols-view": "0.81.0",
|
||||
"tabs": "0.64.0",
|
||||
"timecop": "0.28.0",
|
||||
"timecop": "0.29.0",
|
||||
"tree-view": "0.154.0",
|
||||
"update-package-dependencies": "0.8.0",
|
||||
"welcome": "0.21.0",
|
||||
@@ -125,6 +125,7 @@
|
||||
"language-c": "0.38.0",
|
||||
"language-clojure": "0.10.0",
|
||||
"language-coffee-script": "0.39.0",
|
||||
"language-csharp": "0.5.0",
|
||||
"language-css": "0.27.0",
|
||||
"language-gfm": "0.63.0",
|
||||
"language-git": "0.10.0",
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
path = require 'path'
|
||||
BufferedNodeProcess = require '../src/buffered-node-process'
|
||||
|
||||
describe "BufferedNodeProcess", ->
|
||||
it "executes the script in a new process", ->
|
||||
exit = jasmine.createSpy('exitCallback')
|
||||
output = ''
|
||||
stdout = (lines) -> output += lines
|
||||
error = ''
|
||||
stderr = (lines) -> error += lines
|
||||
args = ['hi']
|
||||
command = path.join(__dirname, 'fixtures', 'script.js')
|
||||
|
||||
new BufferedNodeProcess({command, args, stdout, stderr, exit})
|
||||
|
||||
waitsFor ->
|
||||
exit.callCount is 1
|
||||
|
||||
runs ->
|
||||
expect(output).toBe 'hi'
|
||||
expect(error).toBe ''
|
||||
expect(args).toEqual ['hi']
|
||||
|
||||
it "suppresses deprecations in the new process", ->
|
||||
exit = jasmine.createSpy('exitCallback')
|
||||
output = ''
|
||||
stdout = (lines) -> output += lines
|
||||
error = ''
|
||||
stderr = (lines) -> error += lines
|
||||
command = path.join(__dirname, 'fixtures', 'script-with-deprecations.js')
|
||||
|
||||
new BufferedNodeProcess({command, stdout, stderr, exit})
|
||||
|
||||
waitsFor ->
|
||||
exit.callCount is 1
|
||||
|
||||
runs ->
|
||||
expect(output).toBe 'hi'
|
||||
expect(error).toBe ''
|
||||
@@ -666,6 +666,23 @@ describe "Config", ->
|
||||
foo:
|
||||
bar: 'coffee'
|
||||
|
||||
describe "when an error is thrown writing the file to disk", ->
|
||||
addErrorHandler = null
|
||||
beforeEach ->
|
||||
atom.notifications.onDidAddNotification addErrorHandler = jasmine.createSpy()
|
||||
|
||||
it "creates a notification", ->
|
||||
jasmine.unspy CSON, 'writeFileSync'
|
||||
spyOn(CSON, 'writeFileSync').andCallFake ->
|
||||
error = new Error()
|
||||
error.code = 'EPERM'
|
||||
error.path = atom.config.getUserConfigPath()
|
||||
throw error
|
||||
|
||||
save = -> atom.config.save()
|
||||
expect(save).not.toThrow()
|
||||
expect(addErrorHandler.callCount).toBe 1
|
||||
|
||||
describe ".loadUserConfig()", ->
|
||||
beforeEach ->
|
||||
expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
require('fs').existsSync('hi');
|
||||
process.stdout.write('hi');
|
||||
externo
+1
@@ -0,0 +1 @@
|
||||
process.stdout.write(process.argv[2]);
|
||||
@@ -383,6 +383,25 @@ describe "Pane", ->
|
||||
pane.saveActiveItem()
|
||||
expect(atom.showSaveDialogSync).not.toHaveBeenCalled()
|
||||
|
||||
describe "when the item's saveAs method throws a well-known IO error", ->
|
||||
notificationSpy = null
|
||||
beforeEach ->
|
||||
atom.notifications.onDidAddNotification notificationSpy = jasmine.createSpy()
|
||||
|
||||
it "creates a notification", ->
|
||||
pane.getActiveItem().saveAs = ->
|
||||
error = new Error("EACCES, permission denied '/foo'")
|
||||
error.path = '/foo'
|
||||
error.code = 'EACCES'
|
||||
throw error
|
||||
|
||||
pane.saveActiveItem()
|
||||
expect(notificationSpy).toHaveBeenCalled()
|
||||
notification = notificationSpy.mostRecentCall.args[0]
|
||||
expect(notification.getType()).toBe 'warning'
|
||||
expect(notification.getMessage()).toContain 'Permission denied'
|
||||
expect(notification.getMessage()).toContain '/foo'
|
||||
|
||||
describe "::saveActiveItemAs()", ->
|
||||
pane = null
|
||||
|
||||
@@ -404,6 +423,25 @@ describe "Pane", ->
|
||||
pane.saveActiveItemAs()
|
||||
expect(atom.showSaveDialogSync).not.toHaveBeenCalled()
|
||||
|
||||
describe "when the item's saveAs method throws a well-known IO error", ->
|
||||
notificationSpy = null
|
||||
beforeEach ->
|
||||
atom.notifications.onDidAddNotification notificationSpy = jasmine.createSpy()
|
||||
|
||||
it "creates a notification", ->
|
||||
pane.getActiveItem().saveAs = ->
|
||||
error = new Error("EACCES, permission denied '/foo'")
|
||||
error.path = '/foo'
|
||||
error.code = 'EACCES'
|
||||
throw error
|
||||
|
||||
pane.saveActiveItemAs()
|
||||
expect(notificationSpy).toHaveBeenCalled()
|
||||
notification = notificationSpy.mostRecentCall.args[0]
|
||||
expect(notification.getType()).toBe 'warning'
|
||||
expect(notification.getMessage()).toContain 'Permission denied'
|
||||
expect(notification.getMessage()).toContain '/foo'
|
||||
|
||||
describe "::itemForURI(uri)", ->
|
||||
it "returns the item for which a call to .getURI() returns the given uri", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C"), new Item("D")])
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{$, $$} = require '../src/space-pen-extensions'
|
||||
path = require 'path'
|
||||
fs = require 'fs-plus'
|
||||
temp = require 'temp'
|
||||
TextEditor = require '../src/text-editor'
|
||||
WindowEventHandler = require '../src/window-event-handler'
|
||||
|
||||
@@ -54,7 +56,7 @@ describe "Window", ->
|
||||
jasmine.unspy(TextEditor.prototype, "shouldPromptToSave")
|
||||
beforeUnloadEvent = $.Event(new Event('beforeunload'))
|
||||
|
||||
describe "when pane items are are modified", ->
|
||||
describe "when pane items are modified", ->
|
||||
it "prompts user to save and calls atom.workspace.confirmClose", ->
|
||||
editor = null
|
||||
spyOn(atom.workspace, 'confirmClose').andCallThrough()
|
||||
@@ -92,6 +94,25 @@ describe "Window", ->
|
||||
$(window).trigger(beforeUnloadEvent)
|
||||
expect(atom.confirm).toHaveBeenCalled()
|
||||
|
||||
describe "when the same path is modified in multiple panes", ->
|
||||
it "prompts to save the item", ->
|
||||
editor = null
|
||||
filePath = path.join(temp.mkdirSync('atom-file'), 'file.txt')
|
||||
fs.writeFileSync(filePath, 'hello')
|
||||
spyOn(atom.workspace, 'confirmClose').andCallThrough()
|
||||
spyOn(atom, 'confirm').andReturn(0)
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open(filePath).then (o) -> editor = o
|
||||
|
||||
runs ->
|
||||
atom.workspace.getActivePane().splitRight(copyActiveItem: true)
|
||||
editor.setText('world')
|
||||
$(window).trigger(beforeUnloadEvent)
|
||||
expect(atom.workspace.confirmClose).toHaveBeenCalled()
|
||||
expect(atom.confirm.callCount).toBe 1
|
||||
expect(fs.readFileSync(filePath, 'utf8')).toBe 'world'
|
||||
|
||||
describe ".unloadEditorWindow()", ->
|
||||
it "saves the serialized state of the window so it can be deserialized after reload", ->
|
||||
workspaceState = atom.workspace.serialize()
|
||||
|
||||
@@ -955,9 +955,14 @@ describe "Workspace", ->
|
||||
expect(editor.isModified()).toBeTruthy()
|
||||
|
||||
describe "::saveActivePaneItem()", ->
|
||||
editor = null
|
||||
beforeEach ->
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.js').then (o) -> editor = o
|
||||
|
||||
describe "when there is an error", ->
|
||||
it "emits a warning notification when the file cannot be saved", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
throw new Error("'/some/file' is a directory")
|
||||
|
||||
atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
|
||||
@@ -966,7 +971,7 @@ describe "Workspace", ->
|
||||
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
|
||||
|
||||
it "emits a warning notification when the directory cannot be written to", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
throw new Error("ENOTDIR, not a directory '/Some/dir/and-a-file.js'")
|
||||
|
||||
atom.notifications.onDidAddNotification addedSpy = jasmine.createSpy()
|
||||
@@ -975,7 +980,7 @@ describe "Workspace", ->
|
||||
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
|
||||
|
||||
it "emits a warning notification when the user does not have permission", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
error = new Error("EACCES, permission denied '/Some/dir/and-a-file.js'")
|
||||
error.code = 'EACCES'
|
||||
error.path = '/Some/dir/and-a-file.js'
|
||||
@@ -987,14 +992,14 @@ describe "Workspace", ->
|
||||
expect(addedSpy.mostRecentCall.args[0].getType()).toBe 'warning'
|
||||
|
||||
it "emits a warning notification when the operation is not permitted", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
error = new Error("EPERM, operation not permitted '/Some/dir/and-a-file.js'")
|
||||
error.code = 'EPERM'
|
||||
error.path = '/Some/dir/and-a-file.js'
|
||||
throw error
|
||||
|
||||
it "emits a warning notification when the file is already open by another app", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
error = new Error("EBUSY, resource busy or locked '/Some/dir/and-a-file.js'")
|
||||
error.code = 'EBUSY'
|
||||
error.path = '/Some/dir/and-a-file.js'
|
||||
@@ -1009,7 +1014,7 @@ describe "Workspace", ->
|
||||
expect(notificaiton.getMessage()).toContain 'Unable to save'
|
||||
|
||||
it "emits a warning notification when the file system is read-only", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
error = new Error("EROFS, read-only file system '/Some/dir/and-a-file.js'")
|
||||
error.code = 'EROFS'
|
||||
error.path = '/Some/dir/and-a-file.js'
|
||||
@@ -1024,7 +1029,7 @@ describe "Workspace", ->
|
||||
expect(notification.getMessage()).toContain 'Unable to save'
|
||||
|
||||
it "emits a warning notification when the file cannot be saved", ->
|
||||
spyOn(Pane::, 'saveActiveItem').andCallFake ->
|
||||
spyOn(editor, 'save').andCallFake ->
|
||||
throw new Error("no one knows")
|
||||
|
||||
save = -> atom.workspace.saveActivePaneItem()
|
||||
|
||||
@@ -5,7 +5,7 @@ AutoUpdateManager = require './auto-update-manager'
|
||||
BrowserWindow = require 'browser-window'
|
||||
Menu = require 'menu'
|
||||
app = require 'app'
|
||||
fs = require 'fs'
|
||||
fs = require 'fs-plus'
|
||||
ipc = require 'ipc'
|
||||
path = require 'path'
|
||||
os = require 'os'
|
||||
@@ -342,6 +342,7 @@ class AtomApplication
|
||||
# :window - {AtomWindow} to open file paths in.
|
||||
openPath: ({pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, window}={}) ->
|
||||
{pathToOpen, initialLine, initialColumn} = @locationForPathToOpen(pathToOpen)
|
||||
pathToOpen = fs.normalize(pathToOpen)
|
||||
|
||||
unless pidToKillWhenClosed or newWindow
|
||||
pathToOpenStat = fs.statSyncNoException(pathToOpen)
|
||||
@@ -414,7 +415,6 @@ class AtomApplication
|
||||
openUrl: ({urlToOpen, devMode, safeMode}) ->
|
||||
unless @packages?
|
||||
PackageManager = require '../package-manager'
|
||||
fs = require 'fs-plus'
|
||||
@packages = new PackageManager
|
||||
configDirPath: process.env.ATOM_HOME
|
||||
devMode: devMode
|
||||
|
||||
@@ -2,7 +2,7 @@ global.shellStartTime = Date.now()
|
||||
|
||||
crashReporter = require 'crash-reporter'
|
||||
app = require 'app'
|
||||
fs = require 'fs'
|
||||
fs = require 'fs-plus'
|
||||
path = require 'path'
|
||||
optimist = require 'optimist'
|
||||
nslog = require 'nslog'
|
||||
@@ -43,10 +43,11 @@ start = ->
|
||||
|
||||
cwd = args.executedFrom?.toString() or process.cwd()
|
||||
args.pathsToOpen = args.pathsToOpen.map (pathToOpen) ->
|
||||
pathToOpen = fs.normalize(pathToOpen)
|
||||
if cwd
|
||||
path.resolve(cwd, pathToOpen.toString())
|
||||
path.resolve(cwd, pathToOpen)
|
||||
else
|
||||
path.resolve(pathToOpen.toString())
|
||||
path.resolve(pathToOpen)
|
||||
|
||||
setupCoffeeScript()
|
||||
if args.devMode
|
||||
@@ -77,11 +78,7 @@ setupCoffeeScript = ->
|
||||
setupAtomHome = ->
|
||||
return if process.env.ATOM_HOME
|
||||
|
||||
if process.platform is 'win32'
|
||||
home = process.env.USERPROFILE
|
||||
else
|
||||
home = process.env.HOME
|
||||
atomHome = path.join(home, '.atom')
|
||||
atomHome = path.join(app.getHomeDir(), '.atom')
|
||||
try
|
||||
atomHome = fs.realpathSync(atomHome)
|
||||
process.env.ATOM_HOME = atomHome
|
||||
|
||||
@@ -48,5 +48,8 @@ class BufferedNodeProcess extends BufferedProcess
|
||||
options.env ?= Object.create(process.env)
|
||||
options.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = 1
|
||||
|
||||
args = args?.slice() ? []
|
||||
args.unshift(command)
|
||||
args.unshift('--no-deprecation')
|
||||
|
||||
super({command: node, args, options, stdout, stderr, exit})
|
||||
|
||||
+6
-1
@@ -868,7 +868,12 @@ class Config
|
||||
save: ->
|
||||
allSettings = {'*': @settings}
|
||||
allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource(@getUserConfigPath())
|
||||
CSON.writeFileSync(@configFilePath, allSettings)
|
||||
try
|
||||
CSON.writeFileSync(@configFilePath, allSettings)
|
||||
catch error
|
||||
message = "Failed to save `#{path.basename(@configFilePath)}`"
|
||||
detail = error.message
|
||||
@notifyFailure(message, detail)
|
||||
|
||||
###
|
||||
Section: Private methods managing global settings
|
||||
|
||||
@@ -152,12 +152,12 @@ class PaneContainer extends Model
|
||||
saveAll: ->
|
||||
pane.saveItems() for pane in @getPanes()
|
||||
|
||||
confirmClose: ->
|
||||
confirmClose: (options) ->
|
||||
allSaved = true
|
||||
|
||||
for pane in @getPanes()
|
||||
for item in pane.getItems()
|
||||
unless pane.promptToSaveItem(item)
|
||||
unless pane.promptToSaveItem(item, options)
|
||||
allSaved = false
|
||||
break
|
||||
|
||||
|
||||
+25
-4
@@ -437,8 +437,8 @@ class Pane extends Model
|
||||
destroyInactiveItems: ->
|
||||
@destroyItem(item) for item in @getItems() when item isnt @activeItem
|
||||
|
||||
promptToSaveItem: (item) ->
|
||||
return true unless item.shouldPromptToSave?()
|
||||
promptToSaveItem: (item, options={}) ->
|
||||
return true unless item.shouldPromptToSave?(options)
|
||||
|
||||
if typeof item.getURI is 'function'
|
||||
uri = item.getURI()
|
||||
@@ -481,7 +481,10 @@ class Pane extends Model
|
||||
itemURI = item.getUri()
|
||||
|
||||
if itemURI?
|
||||
item.save?()
|
||||
try
|
||||
item.save?()
|
||||
catch error
|
||||
@handleSaveError(error)
|
||||
nextAction?()
|
||||
else
|
||||
@saveItemAs(item, nextAction)
|
||||
@@ -498,7 +501,10 @@ class Pane extends Model
|
||||
itemPath = item.getPath?()
|
||||
newItemPath = atom.showSaveDialogSync(itemPath)
|
||||
if newItemPath
|
||||
item.saveAs(newItemPath)
|
||||
try
|
||||
item.saveAs(newItemPath)
|
||||
catch error
|
||||
@handleSaveError(error)
|
||||
nextAction?()
|
||||
|
||||
# Public: Save all items.
|
||||
@@ -667,3 +673,18 @@ class Pane extends Model
|
||||
for item in @getItems()
|
||||
return false unless @promptToSaveItem(item)
|
||||
true
|
||||
|
||||
handleSaveError: (error) ->
|
||||
if error.message.endsWith('is a directory')
|
||||
atom.notifications.addWarning("Unable to save file: #{error.message}")
|
||||
else if error.code is 'EACCES' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file: Permission denied '#{error.path}'")
|
||||
else if error.code in ['EPERM', 'EBUSY', 'UNKNOWN'] and error.path?
|
||||
atom.notifications.addWarning("Unable to save file '#{error.path}'", detail: error.message)
|
||||
else if error.code is 'EROFS' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file: Read-only file system '#{error.path}'")
|
||||
else if errorMatch = /ENOTDIR, not a directory '([^']+)'/.exec(error.message)
|
||||
fileName = errorMatch[1]
|
||||
atom.notifications.addWarning("Unable to save file: A directory in the path '#{fileName}' could not be written to")
|
||||
else
|
||||
throw error
|
||||
|
||||
@@ -641,7 +641,11 @@ class TextEditor extends Model
|
||||
|
||||
# Determine whether the user should be prompted to save before closing
|
||||
# this editor.
|
||||
shouldPromptToSave: -> @isModified() and not @buffer.hasMultipleEditors()
|
||||
shouldPromptToSave: ({windowCloseRequested}={}) ->
|
||||
if windowCloseRequested
|
||||
@isModified()
|
||||
else
|
||||
@isModified() and not @buffer.hasMultipleEditors()
|
||||
|
||||
###
|
||||
Section: Reading Text
|
||||
|
||||
@@ -52,7 +52,7 @@ class WindowEventHandler
|
||||
@subscribe $(window), 'blur', -> document.body.classList.add('is-blurred')
|
||||
|
||||
@subscribe $(window), 'beforeunload', =>
|
||||
confirmed = atom.workspace?.confirmClose()
|
||||
confirmed = atom.workspace?.confirmClose(windowCloseRequested: true)
|
||||
atom.hide() if confirmed and not @reloadRequested and atom.getCurrentWindow().isWebViewFocused()
|
||||
@reloadRequested = false
|
||||
|
||||
|
||||
+4
-24
@@ -599,8 +599,8 @@ class Workspace extends Model
|
||||
saveAll: ->
|
||||
@paneContainer.saveAll()
|
||||
|
||||
confirmClose: ->
|
||||
@paneContainer.confirmClose()
|
||||
confirmClose: (options) ->
|
||||
@paneContainer.confirmClose(options)
|
||||
|
||||
# Save the active pane item.
|
||||
#
|
||||
@@ -609,7 +609,7 @@ class Workspace extends Model
|
||||
# {::saveActivePaneItemAs} # will be called instead. This method does nothing
|
||||
# if the active item does not implement a `.save` method.
|
||||
saveActivePaneItem: ->
|
||||
@saveActivePaneItemAndReportErrors('saveActiveItem')
|
||||
@getActivePane().saveActiveItem()
|
||||
|
||||
# Prompt the user for a path and save the active pane item to it.
|
||||
#
|
||||
@@ -617,27 +617,7 @@ class Workspace extends Model
|
||||
# `.saveAs` on the item with the selected path. This method does nothing if
|
||||
# the active item does not implement a `.saveAs` method.
|
||||
saveActivePaneItemAs: ->
|
||||
@saveActivePaneItemAndReportErrors('saveActiveItemAs')
|
||||
|
||||
saveActivePaneItemAndReportErrors: (method) ->
|
||||
try
|
||||
@getActivePane()[method]()
|
||||
catch error
|
||||
if error.message.endsWith('is a directory')
|
||||
atom.notifications.addWarning("Unable to save file: #{error.message}")
|
||||
else if error.code is 'EACCES' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file: Permission denied '#{error.path}'")
|
||||
else if error.code is 'EPERM' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file '#{error.path}'", detail: error.message)
|
||||
else if error.code is 'EBUSY' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file '#{error.path}'", detail: error.message)
|
||||
else if error.code is 'EROFS' and error.path?
|
||||
atom.notifications.addWarning("Unable to save file: Read-only file system '#{error.path}'")
|
||||
else if errorMatch = /ENOTDIR, not a directory '([^']+)'/.exec(error.message)
|
||||
fileName = errorMatch[1]
|
||||
atom.notifications.addWarning("Unable to save file: A directory in the path '#{fileName}' could not be written to")
|
||||
else
|
||||
throw error
|
||||
@getActivePane().saveActiveItemAs()
|
||||
|
||||
# Destroy (close) the active pane item.
|
||||
#
|
||||
|
||||
@@ -13,6 +13,23 @@ window.onload = function() {
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
// Ensure ATOM_HOME is always set before anything else is required
|
||||
if (!process.env.ATOM_HOME) {
|
||||
var home;
|
||||
if (process.platform === 'win32') {
|
||||
home = process.env.USERPROFILE;
|
||||
} else {
|
||||
home = process.env.HOME;
|
||||
}
|
||||
var atomHome = path.join(home, '.atom');
|
||||
try {
|
||||
atomHome = fs.realpathSync(atomHome);
|
||||
} catch (error) {
|
||||
// Ignore since the path might just not exist yet.
|
||||
}
|
||||
process.env.ATOM_HOME = atomHome;
|
||||
}
|
||||
|
||||
// Skip "?loadSettings=".
|
||||
var rawLoadSettings = decodeURIComponent(location.search.substr(14));
|
||||
var loadSettings;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário