fix for windows
This commit is contained in:
parent
935f656add
commit
d999dfa528
2 changed files with 19 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
/node_modules
|
||||
/dist
|
||||
/static/daemon/lbrynet-daemon
|
||||
/static/daemon/lbrynet-daemon*
|
||||
/static/locales
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
|
|
|
@ -11,17 +11,20 @@ const downloadDaemon = targetPlatform =>
|
|||
new Promise((resolve, reject) => {
|
||||
const daemonURLTemplate = packageJSON.lbrySettings.lbrynetDaemonUrlTemplate;
|
||||
const daemonVersion = packageJSON.lbrySettings.lbrynetDaemonVersion;
|
||||
const daemonDir = packageJSON.lbrySettings.lbrynetDaemonDir;
|
||||
const daemonFileName = packageJSON.lbrySettings.lbrynetDaemonFileName;
|
||||
const daemonFilePath = `${__dirname}/../${daemonDir}/${daemonFileName}`;
|
||||
const daemonDir = path.join(__dirname,'..',packageJSON.lbrySettings.lbrynetDaemonDir);
|
||||
let daemonFileName = packageJSON.lbrySettings.lbrynetDaemonFileName;
|
||||
|
||||
let currentPlatform = os.platform();
|
||||
if (currentPlatform === 'darwin') currentPlatform = 'macos';
|
||||
if (currentPlatform === 'win32') currentPlatform = 'windows';
|
||||
if (currentPlatform === 'win32') {
|
||||
currentPlatform = 'windows';
|
||||
daemonFileName = daemonFileName + '.exe';
|
||||
}
|
||||
|
||||
const daemonVersionPath = __dirname + '/daemon.ver';
|
||||
const daemonFilePath = path.join(daemonDir, daemonFileName);
|
||||
const daemonVersionPath = path.join(__dirname, 'daemon.ver');
|
||||
const daemonPlatform = targetPlatform || currentPlatform;
|
||||
const tmpZipPath = __dirname + '/../dist/daemon.zip';
|
||||
const tmpZipPath = path.join(__dirname, '../','dist','daemon.zip');
|
||||
const daemonURL = daemonURLTemplate
|
||||
.replace(/DAEMONVER/g, daemonVersion)
|
||||
.replace(/OSNAME/g, daemonPlatform);
|
||||
|
@ -60,11 +63,12 @@ const downloadDaemon = targetPlatform =>
|
|||
});
|
||||
})
|
||||
)
|
||||
.then(() => del(`${daemonDir}/${daemonFileName}*`))
|
||||
.then(() => del(`${daemonFilePath}*`))
|
||||
.then(() => decompress(tmpZipPath, daemonDir, {
|
||||
filter: file =>
|
||||
path.basename(file.path).replace(path.extname(file.path), '') === daemonFileName,
|
||||
path.basename(file.path) === daemonFileName,
|
||||
}))
|
||||
.then(() => del(`${tmpZipPath }*`))
|
||||
.then(() => {
|
||||
console.log('\x1b[32msuccess\x1b[0m Daemon downloaded!');
|
||||
if (hasDaemonVersion) {
|
||||
|
|
Loading…
Reference in a new issue