2020-03-29 16:52:46 +00:00
|
|
|
const { homedir } = require('os')
|
|
|
|
const { copyFileSync } = require('fs')
|
|
|
|
const { join, basename } = require('path')
|
2020-01-31 18:58:18 +00:00
|
|
|
|
2020-03-29 19:04:37 +00:00
|
|
|
const IS_CI = process.env.CI || process.env.APPVEYOR
|
|
|
|
|
2020-01-31 18:58:18 +00:00
|
|
|
const PUBLIC_DIR = join(__dirname, '..', 'public')
|
2020-03-29 18:12:10 +00:00
|
|
|
const BINDINGS_BUILD_PATH = join(__dirname, '..', 'bindings', 'build', 'Release')
|
2020-01-31 18:58:18 +00:00
|
|
|
|
2020-03-29 16:52:46 +00:00
|
|
|
function moveToPublic (filepath) {
|
2020-03-29 16:59:17 +00:00
|
|
|
try {
|
|
|
|
console.log(`[KawAnime] Copying ${filepath} to public directory.`)
|
2020-01-31 18:58:18 +00:00
|
|
|
|
2020-03-29 16:59:17 +00:00
|
|
|
copyFileSync(
|
|
|
|
filepath,
|
|
|
|
join(PUBLIC_DIR, basename(filepath))
|
|
|
|
)
|
|
|
|
} catch (e) {
|
|
|
|
console.warn(`[KawAnime] Could not find ${filepath}`)
|
|
|
|
}
|
2020-03-29 16:52:46 +00:00
|
|
|
}
|
2020-01-31 18:58:18 +00:00
|
|
|
|
2020-03-29 16:52:46 +00:00
|
|
|
function linux () {
|
|
|
|
// TODO
|
|
|
|
}
|
2020-01-31 18:58:18 +00:00
|
|
|
|
2020-03-29 16:52:46 +00:00
|
|
|
function windows () {
|
2020-03-29 19:04:37 +00:00
|
|
|
const sys32Path = IS_CI ? 'C:\\OpenSSL-Win64' : join(homedir().split('\\')[0], 'Windows', 'System32')
|
2020-03-29 16:52:46 +00:00
|
|
|
const requiredDlls = [
|
2020-03-29 19:04:37 +00:00
|
|
|
IS_CI ? 'libeay32.dll' : 'libcrypto-1_1-x64.dll',
|
|
|
|
IS_CI ? 'ssleay32.dll' : 'libssl-1_1-x64.dll'
|
2020-03-29 16:52:46 +00:00
|
|
|
].map((dll) => join(sys32Path, dll))
|
|
|
|
|
2020-03-29 18:12:10 +00:00
|
|
|
requiredDlls.push(join(BINDINGS_BUILD_PATH, 'torrent-rasterbar.dll'))
|
|
|
|
|
2020-03-29 16:52:46 +00:00
|
|
|
requiredDlls.forEach(moveToPublic)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.platform === 'win32') windows()
|
|
|
|
else linux()
|