mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-20 11:48:30 -06:00
SEARCH-197
- Fixed a bug related to paths
This commit is contained in:
parent
a515ab3c35
commit
e09e708111
@ -1,16 +1,22 @@
|
||||
const child = require('child_process');
|
||||
const isMac = require('../utils/misc.js').isMac;
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const path = require('path');
|
||||
const userData = path.join(app.getPath('userData'));
|
||||
const isDevEnv = require('../utils/misc.js').isDevEnv;
|
||||
const DATA_FOLDER_PATH = isDevEnv ? path.join(__dirname, '..', '..') : userData;
|
||||
|
||||
function compression(pathToFolder, outputPath, cb) {
|
||||
if (isMac) {
|
||||
child.exec(`tar cvf - ${pathToFolder} | lz4 > ${outputPath}.tar.lz4`, (error, stdout) => {
|
||||
child.exec(`cd "${DATA_FOLDER_PATH}" && tar cvf - "${pathToFolder}" | lz4 > "${outputPath}.tar.lz4"`, (error, stdout) => {
|
||||
if (error) {
|
||||
return cb(new Error(error));
|
||||
}
|
||||
return cb(null, stdout);
|
||||
})
|
||||
} else {
|
||||
child.exec(`tar.exe -cvf - ${pathToFolder} | lz4.exe > ${outputPath}.tar.lz4`, (error, stdout) => {
|
||||
child.exec(`cd "${DATA_FOLDER_PATH}" && tar.exe -cvf - "${pathToFolder}" | lz4.exe > "${outputPath}.tar.lz4"`, (error, stdout) => {
|
||||
if (error) {
|
||||
return cb(new Error(error));
|
||||
}
|
||||
@ -19,16 +25,16 @@ function compression(pathToFolder, outputPath, cb) {
|
||||
}
|
||||
}
|
||||
|
||||
function deCompression(path, cb) {
|
||||
function deCompression(pathName, cb) {
|
||||
if (isMac) {
|
||||
child.exec(`lz4 -d ${path} | tar -xf -`, (error, stdout) => {
|
||||
child.exec(`cd "${DATA_FOLDER_PATH}" && lz4 -d "${pathName}" | tar -xf - `, (error, stdout) => {
|
||||
if (error) {
|
||||
return cb(new Error(error));
|
||||
}
|
||||
return cb(null, stdout);
|
||||
})
|
||||
} else {
|
||||
child.exec(`lz4.exe -d ${path} | tar.exe xf -`, (error, stdout) => {
|
||||
child.exec(`cd "${DATA_FOLDER_PATH}" && lz4.exe -d "${pathName}" | tar.exe xf - `, (error, stdout) => {
|
||||
if (error) {
|
||||
return cb(new Error(error));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class Crypto {
|
||||
return;
|
||||
}
|
||||
|
||||
lz4.compression(`${this.indexDataFolder}`, `${this.dump}/${this.permanentIndexFolderName}`, (error) => {
|
||||
lz4.compression(`data/${this.permanentIndexFolderName}`, `${this.permanentIndexFolderName}`, (error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user