Repository: atom/atom
File: src/main-process/parse-command-line.js (JavaScript)

Code before:

  let pidToKillWhenClosed = null
  if (args['wait']) {
    pidToKillWhenClosed = args['pid']
  }

  const logFile = args['log-file']
  const socketPath = args['socket-path']
  const userDataDir = args['user-data-dir']
  const profileStartup = args['profile-startup']
  const clearWindowState = args['clear-window-state']
  let pathsToOpen = []
  let urlsToOpen = []
  let devMode = args['dev']
  let devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH || path.join(app.getPath('home'), 'github', 'atom')
  let resourcePath = null

  for (const path of args._) {
    if (path.startsWith('atom://')) {
      urlsToOpen.push(path)
    } else {
      pathsToOpen.push(path)
    }
  }

  // Check to see if atomproject flag is set, then add all paths from the .atom-project.
  if (args['resource-path']) {
    devMode = true
    devResourcePath = args['resource-path']
  }

  if (test) {
    devMode = true
  }

  let projectSettings = {}
  if (atomProject) {
    const contents = Object.assign({}, readProjectSettingsSync(atomProject, executedFrom))
    const config = contents.config
    const originPath = atomProject
    const paths = contents.paths.map((curPath) =>
      relativizeToAtomProject(curPath, path.dirname(path.join(executedFrom, atomProject))
    ))
    pathsToOpen.push(path.dirname(atomProject))
    projectSettings = { originPath, paths, config }
  }

  if (devMode) {
    resourcePath = devResourcePath
  }


Review comment (suggestion):
"atomproject" -> "project", ".atom-project" -> ".atomproject"

hm. now that i think about it, i guess the code doesn't care what the extension is…we should probably pick something (i vote for ".atomproject.json"), be consistent, and make sure that that's advertised as "the" extension in the docstrings and stuff.

Code after:

  let pidToKillWhenClosed = null
  if (args['wait']) {
    pidToKillWhenClosed = args['pid']
  }

  const logFile = args['log-file']
  const socketPath = args['socket-path']
  const userDataDir = args['user-data-dir']
  const profileStartup = args['profile-startup']
  const clearWindowState = args['clear-window-state']
  let pathsToOpen = []
  let urlsToOpen = []
  let devMode = args['dev']
  let devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH || path.join(app.getPath('home'), 'github', 'atom')
  let resourcePath = null

  for (const path of args._) {
    if (path.startsWith('atom://')) {
      urlsToOpen.push(path)
    } else {
      pathsToOpen.push(path)
    }
  }

  // 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']
  }

  if (test) {
    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 = {