diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 134cf55d2..08f39f2d3 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -210,18 +210,12 @@ class AtomEnvironment extends Model @views.initialize() - @config.initialize({@configDirPath, resourcePath}) - @projectHomeSchema = { - type: 'object', - properties: { - projectHome: { - type: 'string', - default: path.join(fs.getHomeDirectory(), 'github'), - description: 'The directory where projects are assumed to be located. Packages created using the Package Generator will be stored here by default.' - } - } + ConfigSchema.projectHome = { + type: 'string', + default: path.join(fs.getHomeDirectory(), 'github'), + description: 'The directory where projects are assumed to be located. Packages created using the Package Generator will be stored here by default.' } - @config.setSchema('core', @projectHomeSchema) + @config.initialize({@configDirPath, resourcePath, projectHomeSchema: ConfigSchema.projectHome}) @keymaps.configDirPath = @configDirPath @keymaps.resourcePath = resourcePath @@ -322,7 +316,6 @@ class AtomEnvironment extends Model @config.clear() @config.setSchema null, {type: 'object', properties: _.clone(ConfigSchema)} - @config.setSchema('core', @projectHomeSchema) @keymaps.clear() @keymaps.loadBundledKeymaps() diff --git a/src/config.coffee b/src/config.coffee index 575e95a72..46f3c8629 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -401,11 +401,13 @@ class Config constructor: ({@notificationManager, @enablePersistence}={}) -> @clear() - initialize: ({@configDirPath, @resourcePath}) -> + initialize: ({@configDirPath, @resourcePath, projectHomeSchema}) -> if @enablePersistence? @configFilePath = fs.resolve(@configDirPath, 'config', ['json', 'cson']) @configFilePath ?= path.join(@configDirPath, 'config.cson') + @schema.properties.core.properties.projectHome = projectHomeSchema + clear: -> @emitter = new Emitter @schema = diff --git a/src/main-process/atom-application.coffee b/src/main-process/atom-application.coffee index de7d7289c..1df5b9e03 100644 --- a/src/main-process/atom-application.coffee +++ b/src/main-process/atom-application.coffee @@ -17,6 +17,7 @@ url = require 'url' _ = require 'underscore-plus' FindParentDir = null Resolve = null +ConfigSchema = require '../config-schema' LocationSuffixRegExp = /(:\d+)(:\d+)?$/ @@ -69,8 +70,13 @@ class AtomApplication @windows = [] @config = new Config({enablePersistence: true}) - @config.initialize({configDirPath: process.env.ATOM_HOME, @resourcePath}) - @config.setSchema null, {type: 'object', properties: _.clone(require('../config-schema'))} + @config.setSchema null, {type: 'object', properties: _.clone(ConfigSchema)} + ConfigSchema.projectHome = { + type: 'string', + default: path.join(fs.getHomeDirectory(), 'github'), + description: 'The directory where projects are assumed to be located. Packages created using the Package Generator will be stored here by default.' + } + @config.initialize({configDirPath: process.env.ATOM_HOME, @resourcePath, projectHomeSchema: ConfigSchema.projectHome}) @config.load() @fileRecoveryService = new FileRecoveryService(path.join(process.env.ATOM_HOME, "recovery")) @storageFolder = new StorageFolder(process.env.ATOM_HOME)