forked from rockybars/atom-shell-packager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
win32.js
41 lines (34 loc) · 1.23 KB
/
win32.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var path = require('path')
var mv = require('mv')
var series = require('run-series')
var common = require('./common')
module.exports = {
createApp: function createApp (opts, templatePath, callback) {
common.initializeApp(opts, templatePath, path.join('resources', 'app'), function buildWinApp (err, tempPath) {
if (err) return callback(err)
var newExePath = path.join(tempPath, opts.name + '.exe')
var operations = [
function (cb) {
mv(path.join(tempPath, 'electron.exe'), newExePath, cb)
}
]
if (opts.icon || opts['version-string']) {
operations.push(function (cb) {
common.normalizeExt(opts.icon, '.ico', function (err, icon) {
var rcOpts = {}
if (opts['version-string']) rcOpts['version-string'] = opts['version-string']
// Icon might be omitted or only exist in one OS's format, so skip it if normalizeExt reports an error
if (!err) {
rcOpts.icon = icon
}
require('rcedit')(newExePath, rcOpts, cb)
})
})
}
series(operations, function (err) {
if (err) return callback(err)
common.moveApp(opts, tempPath, callback)
})
})
}
}