2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-18 02:25:12 +00:00
nativefier/index.js
Mark Lee 6634913bb2 Add basic Linux support
Copies both the electron-prebuilt distribution into the app's toplevel
dist directory (by default) and the user's app into the correct subdirectory.
2015-05-05 07:43:09 -07:00

31 lines
957 B
JavaScript

var os = require('os')
var path = require('path')
module.exports = function packager (opts, cb) {
var electronPath
var platform
try {
electronPath = require.resolve('electron-prebuilt')
electronPath = path.join(electronPath, '..')
} catch (e) {
try {
electronPath = require.resolve(path.join(process.execPath, '../../lib/node_modules/electron-prebuilt'))
electronPath = path.join(electronPath, '..')
} catch (e) {
cb(new Error('Cannot find electron-prebuilt from here, please install it from npm'))
}
}
var electronPkg = require(path.join(electronPath, 'package.json'))
console.error('Using electron-prebuilt version', electronPkg.version, 'from', electronPath)
switch (os.platform()) {
case 'darwin': platform = require('./mac'); break
case 'linux': platform = require('./linux'); break
default: cb(new Error('Unsupported platform'))
}
platform.createApp(opts, cb, electronPath)
}