diff --git a/src/browser/main.coffee b/src/browser/main.coffee index 989ef537b..ce362839e 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -80,7 +80,7 @@ parseCommandLine = -> opened or a new window if it hasn't. """ options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.') - options.alias('r', 'resource-path').string('r').describe('r', 'Set the path from which Atom loads internal resources and enable dev-mode.') + options.alias('r', 'resource-path').string('r').describe('r', 'Set the path to the Atom source directory and enable dev-mode.') options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.') options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.') options.alias('l', 'log-file').string('l').describe('l', 'Log all output to file.') @@ -114,8 +114,18 @@ parseCommandLine = -> if args['resource-path'] devMode = true resourcePath = args['resource-path'] - else if devMode - resourcePath = global.devResourcePath + else + # Set resourcePath based on to specDirectory if running specs on atom core + if specDirectory? + packageDirectoryPath = path.join(specDirectory, '..') + packageManifestPath = path.join(packageDirectoryPath, 'package.json') + if fs.statSyncNoException(packageManifestPath) + try + packageManifest = JSON.parse(fs.readFileSync(packageManifestPath, 'utf8')) + resourcePath = packageDirectoryPath if packageManifest.name is 'atom' + + if devMode + resourcePath ?= global.devResourcePath unless fs.statSyncNoException(resourcePath) resourcePath = path.dirname(path.dirname(__dirname))