ipcMain.on('nickname', (events, arg) =>
{
fs.writeFileSync(config_path, arg, 'utf-8');
regedit.putValue(
{
'HKCU\\Software\\SAMP': {
'PlayerName': {
type: 'REG_SZ',
value: arg
}
}
},
function(err) {
console.log('regedit error: ' + err);
});
});
This software uses Windows Script Host to read and write to the registry. For that purpose, it will execute .wsf files. When packaging the app's dependencies with ASAR, node-regedit will not be able to access the windows script files, because they are bundled in a single ASAR file. Therefore it is necessary to store the .wsf files elsewhere, outside of the packaged asar file. You can set your custom location for the files with setExternalVBSLocation(location):
// Assuming the files lie in <app>/resources/my-location
const vbsDirectory = path.join(path.dirname(electron.remote.app.getPath('exe')), './resources/my-location');
regedit.setExternalVBSLocation(vbsDirectory);