forked from rockybars/atom-shell-packager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwin32.js
More file actions
51 lines (42 loc) · 1.57 KB
/
win32.js
File metadata and controls
51 lines (42 loc) · 1.57 KB
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
42
43
44
45
46
47
48
49
50
51
var common = require('./common')
var fs = require('fs-extra')
var path = require('path')
var series = require('run-series')
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) {
fs.move(path.join(tempPath, 'electron.exe'), newExePath, cb)
}
]
var rcOpts = {'version-string': opts['version-string'] || {}}
if (opts['build-version']) {
rcOpts['file-version'] = opts['build-version']
}
if (opts['app-version']) {
rcOpts['product-version'] = opts['app-version']
}
if (opts['app-copyright']) {
rcOpts['version-string'].LegalCopyright = opts['app-copyright']
}
if (opts.icon || opts['version-string'] || opts['app-copyright'] || opts['app-version'] || opts['build-version']) {
operations.push(function (cb) {
common.normalizeExt(opts.icon, '.ico', function (err, icon) {
// 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)
})
})
}
}