forked from amilajack/popcorn-time-desktop
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpostinstall.js
59 lines (53 loc) · 1.16 KB
/
postinstall.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// @flow
import os from 'os'
import path from 'path'
import extract from 'extract-zip'
import debug from 'debug'
const log = debug('app:postinstall')
const baseDir = path.join(__dirname, 'node_modules', 'electron', 'dist')
function getUrl(): { platform: string, dest: string } {
switch (os.type()) {
case 'Darwin':
return {
platform: 'osx',
dest : path.join(
baseDir,
'Electron.app',
'Contents',
'Frameworks',
'Electron Framework.framework',
'Libraries',
),
}
case 'Windows_NT':
return {
platform: 'win',
dest : baseDir,
}
case 'Linux':
return {
platform: 'linux',
dest : baseDir,
}
default:
return {
platform: 'linux',
dest : baseDir,
}
}
}
function setupFfmpeg() {
const { platform, dest } = getUrl()
const zipLocation = path.join(
__dirname,
'ffmpeg',
`0.23.5-${platform}-${os.arch()}.zip`,
)
log('--> Replacing ffmpeg...')
extract(zipLocation, { dir: dest }, (error) => {
if (error) {
log(error)
}
})
}
setupFfmpeg()