mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
fix more nits
This commit is contained in:
@@ -981,12 +981,10 @@ class Config {
|
||||
}
|
||||
|
||||
_clearUnscopedSettingsForSource (source) {
|
||||
switch (source) {
|
||||
case (this.projectFile):
|
||||
this.projectSettings = {}
|
||||
return
|
||||
default:
|
||||
this.settings = {}
|
||||
if (source === this.projectFile) {
|
||||
this.projectSettings = {}
|
||||
} else {
|
||||
this.settings = {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,7 +1011,7 @@ class Config {
|
||||
value = getValueAtKeyPath(this.settings, keyPath)
|
||||
if (this.projectFile != null) {
|
||||
const projectValue = getValueAtKeyPath(this.projectSettings, keyPath)
|
||||
value = projectValue || value
|
||||
value = (projectValue === undefined) ? value : projectValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,14 +140,19 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
|
||||
let projectSpecification = {}
|
||||
if (projectSpecificationFile) {
|
||||
const contents = Object.assign({}, readProjectSpecificationSync(projectSpecificationFile, executedFrom))
|
||||
const config = contents.config
|
||||
const originPath = projectSpecificationFile
|
||||
const readPath = path.isAbsolute(projectSpecificationFile)
|
||||
? projectSpecificationFile
|
||||
: path.join(executedFrom, projectSpecificationFile)
|
||||
|
||||
const contents = Object.assign({}, readProjectSpecificationSync(readPath, executedFrom))
|
||||
const pathToProjectFile = path.join(executedFrom, projectSpecificationFile)
|
||||
const base = path.dirname(pathToProjectFile)
|
||||
const paths = contents.paths.map(curPath => path.resolve(base, curPath))
|
||||
pathsToOpen.push(path.dirname(projectSpecificationFile))
|
||||
projectSpecification = { originPath, paths, config }
|
||||
projectSpecification = {
|
||||
originPath: projectSpecificationFile,
|
||||
paths: contents.paths.map(curPath => path.resolve(base, curPath)),
|
||||
config: contents.config
|
||||
}
|
||||
}
|
||||
|
||||
if (devMode) {
|
||||
@@ -195,18 +200,15 @@ module.exports = function parseCommandLine (processArgs) {
|
||||
|
||||
function readProjectSpecificationSync (filepath, executedFrom) {
|
||||
try {
|
||||
const readPath = path.isAbsolute(filepath) ? filepath : path.join(executedFrom, filepath)
|
||||
const contents = CSON.readFileSync(readPath)
|
||||
} catch (e) {
|
||||
throw new Error('Unable to read supplied project specification file.')
|
||||
}
|
||||
|
||||
if (contents.paths == null) {
|
||||
contents.paths = [path.dirname(readPath)]
|
||||
}
|
||||
if (contents.config) {
|
||||
return contents
|
||||
}
|
||||
} catch (e) {}
|
||||
const errorMessage = 'Unable to read supplied project specification file. This file must have a valid array of paths, as well as a valid config object.'
|
||||
throw new Error(errorMessage)
|
||||
if (contents.paths == null) {
|
||||
contents.paths = [path.dirname(readPath)]
|
||||
}
|
||||
return (contents.config == null) ? {} : contents
|
||||
}
|
||||
|
||||
function normalizeDriveLetterName (filePath) {
|
||||
|
||||
Reference in New Issue
Block a user