From ab8b5959d388c0a082b61459e59903f29c90e7e9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:46:34 -0800 Subject: [PATCH 01/11] Add initial Windows atom wrapper script --- resources/win/atom | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 resources/win/atom diff --git a/resources/win/atom b/resources/win/atom new file mode 100644 index 000000000..72a74ec39 --- /dev/null +++ b/resources/win/atom @@ -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" "%~dp0\atom.js" "$@" +fi From 9239b9524129c251eeab285509b58053a6342c3c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:47:01 -0800 Subject: [PATCH 02/11] Use $0 instead of %~dp0 --- resources/win/atom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/win/atom b/resources/win/atom index 72a74ec39..79aee604a 100644 --- a/resources/win/atom +++ b/resources/win/atom @@ -18,5 +18,5 @@ done if [ $EXPECT_OUTPUT ]; then "$0/../../atom.exe" "$@" else - "$0/../app/apm/node_modules/atom-package-manager/bin/node.exe" "%~dp0\atom.js" "$@" + "$0/../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/atom.js" "$@" fi From 59d582722b9af7f4774e5cd356bbf11d5a2411a4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:48:04 -0800 Subject: [PATCH 03/11] Add .sh extension --- build/tasks/build-task.coffee | 1 + resources/win/{atom => atom.sh} | 0 2 files changed, 1 insertion(+) rename resources/win/{atom => atom.sh} (100%) diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index 5ffdf6ce2..b32af1fbf 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -152,6 +152,7 @@ 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') dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug'] diff --git a/resources/win/atom b/resources/win/atom.sh similarity index 100% rename from resources/win/atom rename to resources/win/atom.sh From af116b2b8a5539ad07036421f76eaa46f1dea947 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:50:59 -0800 Subject: [PATCH 04/11] Install atom.sh shim --- src/browser/squirrel-update.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 93e0c464d..d1e143478 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -115,13 +115,17 @@ addCommandsToPath = (callback) -> relativeAtomPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.cmd')) atomCommand = "@echo off\r\n\"%~dp0\\#{relativeAtomPath}\" %*" + relativeAtomShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.sh')) + atomCommand = "#!/bin/sh\r\n\"$0\\#{relativeAtomPath}\" \"$@\"" + 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}\" %*" fs.writeFile atomCommandPath, atomCommand, -> - fs.writeFile apmCommandPath, apmCommand, -> - callback() + fs.writeFile atomShCommandPath, atomShCommand, -> + fs.writeFile apmCommandPath, apmCommand, -> + callback() addBinToPath = (pathSegments, callback) -> pathSegments.push(binFolder) From 0833be4c2778a6639cad6ad42b5af0826c8d6933 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:52:21 -0800 Subject: [PATCH 05/11] Use correct variable name for sh text --- src/browser/squirrel-update.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index d1e143478..6a85734c5 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -116,7 +116,7 @@ addCommandsToPath = (callback) -> atomCommand = "@echo off\r\n\"%~dp0\\#{relativeAtomPath}\" %*" relativeAtomShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.sh')) - atomCommand = "#!/bin/sh\r\n\"$0\\#{relativeAtomPath}\" \"$@\"" + atomShCommand = "#!/bin/sh\r\n\"$0\\#{relativeAtomPath}\" \"$@\"" apmCommandPath = path.join(binFolder, 'apm.cmd') relativeApmPath = path.relative(binFolder, path.join(process.resourcesPath, 'app', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm.cmd')) From 307ce4dc5494746d43ef72cc852a352a57560e8a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 15 Dec 2014 17:52:56 -0800 Subject: [PATCH 06/11] Write atom.sh to atom in bin folder --- src/browser/squirrel-update.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 6a85734c5..6d8f08309 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -115,6 +115,7 @@ 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\\#{relativeAtomPath}\" \"$@\"" From ed1fbcc8e756e4d964d839152a21727e1fdb08ef Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Dec 2014 09:02:09 -0800 Subject: [PATCH 07/11] Use forward slashes in sh path --- src/browser/squirrel-update.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 6d8f08309..2bd15ae2c 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -117,7 +117,7 @@ addCommandsToPath = (callback) -> atomShCommandPath = path.join(binFolder, 'atom') relativeAtomShPath = path.relative(binFolder, path.join(appFolder, 'resources', 'cli', 'atom.sh')) - atomShCommand = "#!/bin/sh\r\n\"$0\\#{relativeAtomPath}\" \"$@\"" + 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')) From 89ed95e2ae15ea39726653f74a2ba28bd2772968 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Dec 2014 09:08:26 -0800 Subject: [PATCH 08/11] Add apm sh shim --- resources/win/apm.sh | 3 +++ src/browser/squirrel-update.coffee | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 resources/win/apm.sh diff --git a/resources/win/apm.sh b/resources/win/apm.sh new file mode 100644 index 000000000..9537f8a32 --- /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/src/browser/squirrel-update.coffee b/src/browser/squirrel-update.coffee index 2bd15ae2c..f41975147 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -123,10 +123,15 @@ addCommandsToPath = (callback) -> 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 atomShCommandPath, atomShCommand, -> fs.writeFile apmCommandPath, apmCommand, -> - callback() + fs.writeFile apmShCommandPath, apmShCommand, -> + callback() addBinToPath = (pathSegments, callback) -> pathSegments.push(binFolder) From 9126f2e45c4aa049dedd1bae7955e888d14d3f6f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Dec 2014 09:19:40 -0800 Subject: [PATCH 09/11] Include apm.sh --- build/tasks/build-task.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index b32af1fbf..6d77a4988 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -154,6 +154,7 @@ module.exports = (grunt) -> 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' From 7ee3ccb43d7f965b35913c72c7566335ddeaeefa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Dec 2014 09:33:16 -0800 Subject: [PATCH 10/11] Move up one more directory --- resources/win/apm.sh | 2 +- resources/win/atom.sh | 4 ++-- src/browser/squirrel-update.coffee | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/win/apm.sh b/resources/win/apm.sh index 9537f8a32..3a317ca9d 100644 --- a/resources/win/apm.sh +++ b/resources/win/apm.sh @@ -1,3 +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" "$@" +"$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 index 79aee604a..b8ddb986d 100644 --- a/resources/win/atom.sh +++ b/resources/win/atom.sh @@ -16,7 +16,7 @@ while getopts ":fhtvw-:" opt; do done if [ $EXPECT_OUTPUT ]; then - "$0/../../atom.exe" "$@" + "$0/../../../atom.exe" "$@" else - "$0/../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/atom.js" "$@" + "$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 f41975147..464e515e6 100644 --- a/src/browser/squirrel-update.coffee +++ b/src/browser/squirrel-update.coffee @@ -117,7 +117,7 @@ addCommandsToPath = (callback) -> 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, '/')}\" \"$@\"" + 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')) @@ -125,7 +125,7 @@ addCommandsToPath = (callback) -> 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, '/')}\" \"$@\"" + apmShCommand = "#!/bin/sh\r\n\"$0/../#{relativeApmShPath.replace(/\\/g, '/')}\" \"$@\"" fs.writeFile atomCommandPath, atomCommand, -> fs.writeFile atomShCommandPath, atomShCommand, -> From 83d58909625dac3d41d6e2fdbe8533549a4063a0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 16 Dec 2014 09:40:16 -0800 Subject: [PATCH 11/11] Add missing .. segment --- resources/win/atom.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/win/atom.sh b/resources/win/atom.sh index b8ddb986d..ed6af2292 100644 --- a/resources/win/atom.sh +++ b/resources/win/atom.sh @@ -18,5 +18,5 @@ done if [ $EXPECT_OUTPUT ]; then "$0/../../../atom.exe" "$@" else - "$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/atom.js" "$@" + "$0/../../app/apm/node_modules/atom-package-manager/bin/node.exe" "$0/../atom.js" "$@" fi