Skip to content

Commit

Permalink
Testing the code breaks the script
Browse files Browse the repository at this point in the history
Reverting 1c08dc1
  • Loading branch information
zekrom-vale committed Apr 9, 2024
1 parent 0a70f9a commit 12b8473
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ const { URL } = require('url');
process.env.NODE_ENV = process.platform
const config = require("config")

// TESTING EXPORT OBJECT exports
Object.defineProperty(exports, "__esModule", { value: true });

// Error
function error(msg, name=""){
console.warn(`${name}: ${msg}`);
Expand Down Expand Up @@ -56,9 +53,6 @@ function platform(plat=process.platform, test=false){
var home=path.join(app.getAppPath(), config.get("R.path.home"))
// Must use ! as / is an issue with paths
var exec = `sed -i${_i} 's!R_HOME_DIR=.*$!R_HOME_DIR="${home}"!' ${execPath}`
// START TEST CODE
if(test) return exec
// END TEST CODE
if(execPortable && config.get("R.path.fixHome"))shell(exec)
break
default:
Expand All @@ -82,8 +76,6 @@ function startR(){
)
childProcess.stdout.on('data', data => console.log(`Rout: ${data}`))
childProcess.stderr.on('data', data => console.warn(`Rerr: ${data}`))
// TESTING EXPORT childProcess
exports.childProcess=childProcess
}

// Keep a global reference of the window object, if you don't, the window will
Expand Down Expand Up @@ -115,8 +107,6 @@ async function createWindow(){
}

mainWindow = new BrowserWindow(config.get("window.config"))
// TESTING EXPORT mainWindow
exports.mainWindow=mainWindow

////////////////////////////////////////////////////////////////////////////////
// Connect to Shiny
Expand Down Expand Up @@ -212,31 +202,21 @@ function cleanUpApplication(quit=true){
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.

// TESTING SWITCH START SHOULD ALWAYS BE TRUE
if (module.parent == undefined){
app.on('ready', createWindow)
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if(mainWindow === null) createWindow()
})
app.on('ready', createWindow)
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if(mainWindow === null) createWindow()
})

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// Quit when all windows are closed.
app.on('window-all-closed', function () {

console.log(now()+'::window-all-closed')
cleanUpApplication()
if(config.get("app.quitOnClose"))app.quit()
})

console.log(now()+'::window-all-closed')
cleanUpApplication()
if(config.get("app.quitOnClose"))app.quit()
})
}
// TESTING CODE ONLY / WHEN REQUIRED
else{
exports.startR = startR
exports.createWindow = createWindow
exports.cleanUpApplication = cleanUpApplication
exports.platform = platform
}
// TESTING SWITCH END

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
Expand Down

0 comments on commit 12b8473

Please sign in to comment.