Skip to content
Snippets Groups Projects
Commit bf78d909 authored by ac's avatar ac
Browse files

leversc nvm integration linux

parent 6eaaa77c
Branches
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = require('url')
const {ipcMain} = require('electron');
......@@ -24,7 +23,9 @@ function createWindow ()
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600, icon:path.join(__dirname,'..','leverjs/leverjs.ico'),
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
}
});
......
......@@ -41,7 +41,8 @@ var miniMapmousedrag = false;
// database is read only
var gbReadOnlyDB=false;
const IS_NODE = typeof module !== 'undefined' && module.exports;
// const IS_NODE = typeof module !== 'undefined' && module.exports;
var IS_NODE = navigator.userAgent.indexOf('Electron') >= 0
// set to tell render.js (reDraw) not to kick off a multires if we're in the experiment window
var gbExperimentRender=false;
......@@ -171,7 +172,7 @@ window.onload = function () {
ROOT=params[1].slice('ROOT='.length)
title=params[2].slice('TITLE='.length)
console.log('lever figure window found :: port='+port+" :: root="+root)
console.log('lever figure window found :: port='+port+" :: root="+ROOT)
uiServer.init(port,window)
document.title='leversc '+title
setLeverscUI()
......
......@@ -106,8 +106,18 @@ end
function launch_electron_posix(port,fignum,workdir, leverpath,strDB)
elec_cmd = 'leverjs';
px = getenv('PATH');
if ( ~isempty(leverpath) )
% first try NVM
nvm_path = getenv('NVM_DIR');
if ~isempty(nvm_path)
[ret,elec_path] = system('source ~/.nvm/nvm.sh;which electron');
elec_path = replace(elec_path,newline,'');
nodePath = fileparts(elec_path);
px = [px ':' nodePath];
else
elec_path = fullfile(leverpath,'node_modules','.bin','electron');
end
elec_cmd = [elec_path ' ' fullfile(leverpath,'elever','main.js')];
else
[status,~] = system(['which ' elec_cmd]);
......@@ -118,8 +128,8 @@ end
if exist('strDB','var') && ~isempty(strDB)
elec_cmd = [elec_cmd ' --leverFile=' strDB ' '];
end
cmd = [elec_cmd ' --port=' num2str(port) ' --title="figure ' num2str(fignum) '"' ' &'];
system(cmd);
cmd = [elec_cmd ' --port=' num2str(port) ' --title="figure ' num2str(fignum) '"' ' &']
system(cmd,'PATH',px);
end
function launch_electron_windows(port,fignum,workdir, leverpath, strDB)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment