mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add global config object. Config#load loads user's atom.coffee.
This commit is contained in:
7
src/app/config.coffee
Normal file
7
src/app/config.coffee
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports =
|
||||
class Config
|
||||
load: ->
|
||||
try
|
||||
require atom.configFilePath if fs.exists(atom.configFilePath)
|
||||
catch error
|
||||
console.error "Failed to load `#{atom.configFilePath}`", error.stack, error
|
||||
@@ -36,6 +36,8 @@ class RootView extends View
|
||||
|
||||
initialize: (pathToOpen, { @extensionStates, suppressOpen } = {}) ->
|
||||
window.rootView = this
|
||||
config.load()
|
||||
|
||||
TextMateTheme.activate('IR_Black')
|
||||
|
||||
@invisibles =
|
||||
@@ -47,7 +49,6 @@ class RootView extends View
|
||||
@extensions = {}
|
||||
@project = new Project(pathToOpen)
|
||||
@handleEvents()
|
||||
@loadUserConfiguration()
|
||||
|
||||
if pathToOpen
|
||||
@open(pathToOpen) if fs.isFile(pathToOpen) and not suppressOpen
|
||||
@@ -263,11 +264,5 @@ class RootView extends View
|
||||
|
||||
getInvisibles: -> @invisibles
|
||||
|
||||
loadUserConfiguration: ->
|
||||
try
|
||||
require atom.configFilePath if fs.exists(atom.configFilePath)
|
||||
catch error
|
||||
console.error "Failed to load `#{atom.configFilePath}`", error.stack, error
|
||||
|
||||
saveAll: ->
|
||||
editor.save() for editor in @getEditors()
|
||||
|
||||
@@ -8,6 +8,7 @@ fs = require 'fs'
|
||||
_ = require 'underscore'
|
||||
$ = require 'jquery'
|
||||
{CoffeeScript} = require 'coffee-script'
|
||||
Config = require 'config'
|
||||
RootView = require 'root-view'
|
||||
Pasteboard = require 'pasteboard'
|
||||
require 'jquery-extensions'
|
||||
@@ -26,6 +27,7 @@ windowAdditions =
|
||||
TextMateTheme.loadAll()
|
||||
@setUpKeymap()
|
||||
@pasteboard = new Pasteboard
|
||||
@config = new Config
|
||||
$(window).on 'core:close', => @close()
|
||||
|
||||
# This method is intended only to be run when starting a normal application
|
||||
|
||||
Reference in New Issue
Block a user