From be1c139b5a8efec3462f0f08d8bead7a16086617 Mon Sep 17 00:00:00 2001 From: Stefan Buck Date: Fri, 24 Apr 2015 14:07:39 +0200 Subject: [PATCH] add --icon support --- index.js | 15 ++++++++++++++- readme.md | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9106c69..d73d3b8 100644 --- a/index.js +++ b/index.js @@ -109,9 +109,22 @@ module.exports = function packager (opts, cb) { var finalPath = path.join(opts.out || process.cwd(), opts.name + '.app') fs.rename(newApp, finalPath, function moved (err) { - cb(err, finalPath) + if (err) return cb(err) + updateMacIcon() }) } }) } + + function updateMacIcon () { + var finalPath = path.join(opts.out || process.cwd(), opts.name + '.app') + + if (!opts.icon) { + return cb(null, finalPath) + } + + ncp(opts.icon, path.join(finalPath, 'Contents', 'Resources', 'atom.icns'), function copied (err) { + cb(err, finalPath) + }) + } } diff --git a/readme.md b/readme.md index 5f158af..756ffd0 100644 --- a/readme.md +++ b/readme.md @@ -42,6 +42,7 @@ these are optional CLI options you can pass in - `out` (default current working dir) - the dir to put the app into at the end - `version` (default hardcoded in source) - atom-shell version to use +- `icon` - the icon file to use as the icon for the app - `app-bundle-id` - bundle identifier to use in the app plist - `helper-bundle-id` - bundle identifier to use in the app helper plist - `ignore` (default none) - do not copy files into App whose filenames regex .match this string