From 85d745cbec340c9e0cad42cabe0b3d0ac23f9f36 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 24 Apr 2018 17:25:43 -0700 Subject: [PATCH] Remove 'project' command line flag From what I can tell, this flag never worked correctly. Instead of opening the paths specified in the project file, the directory containing the project file itself would always be opened. --- src/main-process/atom-application.js | 6 +--- src/main-process/atom-window.js | 4 +-- src/main-process/parse-command-line.js | 39 -------------------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index 9d3c45030..9272b00c8 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -204,7 +204,6 @@ class AtomApplication extends EventEmitter { openWithOptions (options) { const { - projectSpecification, initialPaths, pathsToOpen, executedFrom, @@ -259,7 +258,6 @@ class AtomApplication extends EventEmitter { profileStartup, clearWindowState, addToLastWindow, - projectSpecification, env }) } else if (urlsToOpen.length > 0) { @@ -829,7 +827,6 @@ class AtomApplication extends EventEmitter { window, clearWindowState, addToLastWindow, - projectSpecification, env } = {}) { if (!pathsToOpen || pathsToOpen.length === 0) return @@ -863,7 +860,7 @@ class AtomApplication extends EventEmitter { } let openedWindow - if (existingWindow && (projectSpecification == null || projectSpecification.config == null)) { + if (existingWindow) { openedWindow = existingWindow openedWindow.openLocations(locationsToOpen) if (openedWindow.isMinimized()) { @@ -899,7 +896,6 @@ class AtomApplication extends EventEmitter { windowDimensions, profileStartup, clearWindowState, - projectSpecification, env }) this.addWindow(openedWindow) diff --git a/src/main-process/atom-window.js b/src/main-process/atom-window.js index 7c4151403..f8b158934 100644 --- a/src/main-process/atom-window.js +++ b/src/main-process/atom-window.js @@ -22,7 +22,6 @@ class AtomWindow extends EventEmitter { this.safeMode = settings.safeMode this.devMode = settings.devMode this.resourcePath = settings.resourcePath - this.projectSpecification = settings.projectSpecification let {pathToOpen, locationsToOpen} = settings if (!locationsToOpen && pathToOpen) locationsToOpen = [{pathToOpen}] @@ -60,8 +59,7 @@ class AtomWindow extends EventEmitter { get: () => JSON.stringify(Object.assign({ userSettings: !this.isSpec ? this.atomApplication.configFile.get() - : null, - projectSpecification: this.projectSpecification + : null }, this.loadSettings)) }) diff --git a/src/main-process/parse-command-line.js b/src/main-process/parse-command-line.js index d844b4033..5c074a14e 100644 --- a/src/main-process/parse-command-line.js +++ b/src/main-process/parse-command-line.js @@ -5,7 +5,6 @@ const yargs = require('yargs') const {app} = require('electron') const path = require('path') const fs = require('fs-plus') -const CSON = require('season') module.exports = function parseCommandLine (processArgs) { const options = yargs(processArgs).wrap(yargs.terminalWidth()) @@ -53,7 +52,6 @@ module.exports = function parseCommandLine (processArgs) { 'When in test mode, waits until the specified time (in minutes) and kills the process (exit code: 130).' ) options.alias('v', 'version').boolean('v').describe('v', 'Print the version information.') - options.alias('p', 'project').describe('p', 'Start Atom with a project specification file.') options.alias('w', 'wait').boolean('w').describe('w', 'Wait for window to be closed before returning.') options.alias('a', 'add').boolean('a').describe('add', 'Open path as a new project in last used window.') options.string('socket-path') @@ -93,7 +91,6 @@ module.exports = function parseCommandLine (processArgs) { const benchmark = args['benchmark'] const benchmarkTest = args['benchmark-test'] const test = args['test'] - const projectSpecificationFile = args['project'] const mainProcess = args['main-process'] const timeout = args['timeout'] const newWindow = args['new-window'] @@ -128,7 +125,6 @@ module.exports = function parseCommandLine (processArgs) { } } - // Check to see if project flag is set, then add all paths from the .atomproject. if (args['resource-path']) { devMode = true devResourcePath = args['resource-path'] @@ -138,28 +134,6 @@ module.exports = function parseCommandLine (processArgs) { devMode = true } - let projectSpecification = {} - if (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) - pathsToOpen.push(path.dirname(projectSpecificationFile)) - const paths = (contents.paths == null) - ? undefined - : contents.paths.map(curPath => path.resolve(base, curPath)) - - projectSpecification = { - originPath: pathToProjectFile, - paths, - config: contents.config - } - } - if (devMode) { resourcePath = devResourcePath } @@ -178,7 +152,6 @@ module.exports = function parseCommandLine (processArgs) { devResourcePath = normalizeDriveLetterName(devResourcePath) return { - projectSpecification, resourcePath, devResourcePath, pathsToOpen, @@ -204,18 +177,6 @@ module.exports = function parseCommandLine (processArgs) { } } -function readProjectSpecificationSync (filepath, executedFrom) { - let contents - try { - contents = CSON.readFileSync(filepath) - } catch (e) { - throw new Error('Unable to read supplied project specification file.') - } - - contents.config = (contents.config == null) ? {} : contents.config - return contents -} - function normalizeDriveLetterName (filePath) { if (process.platform === 'win32') { return filePath.replace(/^([a-z]):/, ([driveLetter]) => driveLetter.toUpperCase() + ':')