I am currently working on an Electron-App using NPM that unzips a file to a selected directory. An Installer basically. Now when I build the application it still works fine. I simply start the setup.exe in my win-unpacked folder and everything goes down smoothly. Now when I move the win-unpacked folder to a different directory my app runs fine but when it starts the unzipping process it throws the following error:
I have noticed, that the first file-path displayed (for some reason) doesnt use utf8, but all the others are being displayed correctly (should be an รค). Also I have allready tried deleting the node_modules folder and then running npm i to reinstall them. Still having the same issue.
The following is the code that starts the unzipping process:
const path = require('path');
const ipcRenderer = require('electron').ipcRenderer;
const Unzip = require('./unzip');
const os = require('os');
const fs = require('fs');
$('#information_next').click(function () {
var extractPath = $('#input_select').val();
let filepath;
const platform = os.platform();
const nodeName = platform == 'win32' ? 'wcd.node' : (platform == 'darwin' ? 'mcd.node' : 'lcd.node');
let customData = require("bindings")(nodeName);
let zip = h2a(customData.customData());
if(os.platform() == 'darwin') {
filepath = path.join(__dirname, '..', '..', '..', '..', 'ZIP.zip');
} else {
filepath = path.join(__dirname, '..', '..', 'ZIP.zip');
}
var xPath = path.join.apply(null, extractPath.split('\\'));
var unzip = new Unzip(filepath, xPath.toString());
unzip.extract(extractPath, zip, 100, (percentage) => {
// Code for Progressbar
finish = true;
setTimeout(function () {
$('.main_wrapper').addClass('hidden');
$('.main7').removeClass('hidden');
}, 1500);
}).catch((e) => {
$('.main6').addClass('hidden');
$('.main_install_error').prop('hidden', false);
});
});
Here I am using the bindings module to require a .node file which passes a string to my app. And this seems to be the module that causes the Error.
I have been trying to resolve this for hours now, but nothing I've found online works. Also I couldn't find anyone who had the same Error that I have. Any suggestions on how to fix this would be appreciated.
Greetings
Matt.S
from Electron app Error when moving build folder

No comments:
Post a Comment