diff --git a/src/main/handlers/Initalization.ts b/src/main/handlers/Initalization.ts index 1388a2f..5e8748d 100644 --- a/src/main/handlers/Initalization.ts +++ b/src/main/handlers/Initalization.ts @@ -244,10 +244,7 @@ export const initialization = async ( initializedDatas.initPluginCanInstall = getPluginCanInstallReturned.result as boolean mainLog.log(getPluginCanInstallReturned) - if ( - (os.platform() === 'darwin' || os.platform() === 'linux') && - !initializedDatas.initPluginCanInstall - ) { + if (!initializedDatas.initPluginCanInstall) { mainLog.debug(`os.platform():`, os.platform()) mainLog.debug( `!initializedDatas.initPluginCanInstall`, @@ -274,27 +271,6 @@ export const initialization = async ( mainLog.log(errorOnFixingUserRights) return false } - } else if ( - !(os.platform() === 'darwin' || os.platform() === 'linux') && - !initializedDatas.initPluginCanInstall - ) { - mainLog.debug(`os.platform():`, os.platform()) - mainLog.debug( - `!initializedDatas.initPluginCanInstall`, - !initializedDatas.initPluginCanInstall - ) - // #region Can't Fix User rights - const cantFixUserRights = new ConfigData( - 'app_can_not_be_launched', - 'error_type_cant_fix_user_rights' - ) - cantFixUserRights.error = `Can't fix user rights` - cantFixUserRights.message = `Need to fix user rights on ${os.platform()}` - getMainWindow().webContents.send( - channels.INITIALIZATION_DATAS, - cantFixUserRights - ) - return false } else { mainLog.log(`User can install plugins`) } diff --git a/src/main/handlers/initHandlers/plugin_canInstall.ts b/src/main/handlers/initHandlers/plugin_canInstall.ts index 0483cc3..677b0a8 100644 --- a/src/main/handlers/initHandlers/plugin_canInstall.ts +++ b/src/main/handlers/initHandlers/plugin_canInstall.ts @@ -72,38 +72,32 @@ export const initSudoFixNpmDirRights = ( const mainLog = getMainLog().scope( 'main/initialization/initSudoFixNpmDirRights' ) - if (os.platform() === 'darwin') { - mainLog.debug(`Fix User rights on NPM Dir with sudo.`) - const toReturned = new ConfigData('fix_npm_user_rights') - return new Promise((resolve) => { - const cmd = `chown -R $USER $(npm config get prefix)/{lib/node_modules,bin,share} && echo "Done"` - sudoPrompt.exec( - cmd, - { name: 'Fix user permissions on Node' }, - (error, stdout, stderr) => { - if (error) { - mainLog.error(`exec error: ${error}`) - toReturned.error = error - toReturned.message = `CAN'T fix Npm user rights` - return resolve(toReturned) - } - if (stderr) mainLog.debug(`stderr: ${stderr}`) - if (stdout) { - const returned: string = (stdout as string).trim() - toReturned.result = true - toReturned.message = `User rights FIXED returned ${returned}` - // getMainWindow().webContents.send( - // channels.HOST_INFORMATIONS_BACK, - // toReturned - // ) - return resolve(toReturned) - } + mainLog.debug(`Fix User rights on NPM Dir with sudo.`) + const toReturned = new ConfigData('fix_npm_user_rights') + return new Promise((resolve) => { + const cmd = `chown -R $USER $(npm config get prefix)/{lib/node_modules,bin,share} && echo "Done"` + sudoPrompt.exec( + cmd, + { name: 'Fix user permissions on Node' }, + (error, stdout, stderr) => { + if (error) { + mainLog.error(`exec error: ${error}`) + toReturned.error = error + toReturned.message = `CAN'T fix Npm user rights` + return resolve(toReturned) } - ) - }) - } else { - mainLog.debug( - `NOT ON DARWIN PLATFORM, CAN'T Fix User rights on NPM Dir.` + if (stderr) mainLog.debug(`stderr: ${stderr}`) + if (stdout) { + const returned: string = (stdout as string).trim() + toReturned.result = true + toReturned.message = `User rights FIXED returned ${returned}` + // getMainWindow().webContents.send( + // channels.HOST_INFORMATIONS_BACK, + // toReturned + // ) + return resolve(toReturned) + } + } ) - } + }) }