8000 Remove 'project' command line flag by maxbrunsfeld · Pull Request #17212 · atom/atom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Remove 'project' command line flag #17212

Merged
merged 1 commit into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/main-process/atom-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ class AtomApplication extends EventEmitter {

openWithOptions (options) {
const {
projectSpecification,
initialPaths,
pathsToOpen,
executedFrom,
Expand Down Expand Up @@ -259,7 +258,6 @@ class AtomApplication extends EventEmitter {
profileStartup,
clearWindowState,
addToLastWindow,
projectSpecification,
env
})
} else if (urlsToOpen.length > 0) {
Expand Down Expand Up @@ -829,7 +827,6 @@ class AtomApplication extends EventEmitter {
window,
clearWindowState,
addToLastWindow,
projectSpecification,
env
} = {}) {
if (!pathsToOpen || pathsToOpen.length === 0) return
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -899,7 +896,6 @@ class AtomApplication extends EventEmitter {
windowDimensions,
profileStartup,
clearWindowState,
projectSpecification,
env
})
this.addWindow(openedWindow)
Expand Down
4 changes: 1 addition & 3 deletions src/main-process/atom-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
Expand Down Expand Up @@ -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))
})

Expand Down
39 changes: 0 additions & 39 deletions src/main-process/parse-command-line.js
8000
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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']
Expand All @@ -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
}
Expand All @@ -178,7 +152,6 @@ module.exports = function parseCommandLine (processArgs) {
devResourcePath = normalizeDriveLetterName(devResourcePath)

return {
projectSpecification,
resourcePath,
devResourcePath,
pathsToOpen,
Expand All @@ -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() + ':')
Expand Down
0