SEARCH-197

- lz4 for 32bit
This commit is contained in:
Keerthi Niranjan 2017-10-19 11:10:33 +05:30
parent bb3fc8f795
commit af985b6d46
3 changed files with 8 additions and 7 deletions

View File

@ -9,12 +9,13 @@ const DATA_FOLDER_PATH = isDevEnv ? path.join(__dirname, '..', '..') : userData;
const execPath = path.dirname(app.getPath('exe')); const execPath = path.dirname(app.getPath('exe'));
// library path contractor // lz4 library path
const folderLibPath = 'library'; const libraryFolderPath = isDevEnv ? path.join(__dirname, '..', '..', 'library') : path.join(execPath, 'library');
const productionPath = path.join(execPath, folderLibPath); const winArchPath = process.arch === 'ia32' ? 'lz4-win-x86.exe' : 'lz4-win-x64.exe';
const devPath = path.join(__dirname, '..', '..', folderLibPath); const productionPath = path.join(execPath, libraryFolderPath, winArchPath);
const devPath = path.join(__dirname, '..', '..', 'library', winArchPath);
const libraryPath = isDevEnv ? devPath : productionPath; const lz4Path = isDevEnv ? devPath : productionPath;
function compression(pathToFolder, outputPath, cb) { function compression(pathToFolder, outputPath, cb) {
if (isMac) { if (isMac) {
@ -25,7 +26,7 @@ function compression(pathToFolder, outputPath, cb) {
return cb(null, stdout); return cb(null, stdout);
}) })
} else { } else {
child.exec(`cd "${DATA_FOLDER_PATH}" && "${libraryPath}\\tar-win.exe" cvf - "${pathToFolder}" | "${libraryPath}\\lz4-win.exe" > "${outputPath}.tar.lz4"`, (error, stdout) => { child.exec(`cd "${DATA_FOLDER_PATH}" && "${libraryFolderPath}\\tar-win.exe" cvf - "${pathToFolder}" | "${lz4Path}" > "${outputPath}.tar.lz4"`, (error, stdout) => {
if (error) { if (error) {
return cb(new Error(error)); return cb(new Error(error));
} }
@ -43,7 +44,7 @@ function deCompression(pathName, cb) {
return cb(null, stdout); return cb(null, stdout);
}) })
} else { } else {
child.exec(`cd "${DATA_FOLDER_PATH}" && "${libraryPath}\\lz4-win.exe" -d "${pathName}" | "${libraryPath}\\tar-win.exe" xf - `, (error, stdout) => { child.exec(`cd "${DATA_FOLDER_PATH}" && "${lz4Path}" -d "${pathName}" | "${libraryFolderPath}\\tar-win.exe" xf - `, (error, stdout) => {
if (error) { if (error) {
return cb(new Error(error)); return cb(new Error(error));
} }

BIN
library/lz4-win-x86.exe Executable file

Binary file not shown.