diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index 5ffdf6ce2..6d77a4988 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -152,7 +152,9 @@ module.exports = (grunt) -> if process.platform is 'win32' cp path.join('resources', 'win', 'atom.cmd'), path.join(shellAppDir, 'resources', 'cli', 'atom.cmd') + cp path.join('resources', 'win', 'atom.sh'), path.join(shellAppDir, 'resources', 'cli', 'atom.sh') cp path.join('resources', 'win', 'atom.js'), path.join(shellAppDir, 'resources', 'cli', 'atom.js') + cp path.join('resources', 'win', 'apm.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh') dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug'] dependencies.push('copy-info-plist') if process.platform is 'darwin' diff --git a/resources/win/apm.sh b/resources/win/apm.sh new file mode 100644 index 000000000..3a317ca9d --- /dev/null +++ b/resources/win/apm.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/../../app/apm/node_modules/atom-package-manager/lib/cli.js" "$@" diff --git a/resources/win/atom.sh b/resources/win/atom.sh new file mode 100644 index 000000000..ed6af2292 --- /dev/null +++ b/resources/win/atom.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +while getopts ":fhtvw-:" opt; do + case "$opt" in + -) + case "${OPTARG}" in + foreground|help|test|version|wait) + EXPECT_OUTPUT=1 + ;; + esac + ;; + f|h|t|v|w) + EXPECT_OUTPUT=1 + ;; + esac +done + +if [ $EXPECT_OUTPUT ]; then + "$0/../../../atom.exe" "$@" +else + "$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/../atom.js" "$@" +fi diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 93e0c464d..464e515e6 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -115,13 +115,23 @@ addCommandsToPath = (callback) -> relativeAtomPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.cmd')) atomCommand = "@echo off\r\n\"%~dp0\\#{relativeAtomPath}\" %*" + atomShCommandPath = path.join(binFolder, 'atom') + relativeAtomShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.sh')) + atomShCommand = "#!/bin/sh\r\n\"$0/../#{relativeAtomShPath.replace(/\\/g, '/')}\" \"$@\"" + apmCommandPath = path.join(binFolder, 'apm.cmd') relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'app', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd')) apmCommand = "@echo off\r\n\"%~dp0\\#{relativeApmPath}\" %*" + apmShCommandPath = path.join(binFolder, 'apm') + relativeApmShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'apm.sh')) + apmShCommand = "#!/bin/sh\r\n\"$0/../#{relativeApmShPath.replace(/\\/g, '/')}\" \"$@\"" + fs.writeFile atomCommandPath, atomCommand, -> - fs.writeFile apmCommandPath, apmCommand, -> - callback() + fs.writeFile atomShCommandPath, atomShCommand, -> + fs.writeFile apmCommandPath, apmCommand, -> + fs.writeFile apmShCommandPath, apmShCommand, -> + callback() addBinToPath = (pathSegments, callback) -> pathSegments.push(binFolder)