-
Notifications
You must be signed in to change notification settings - Fork 27
/
main.js
59 lines (50 loc) · 1.46 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
global.electron = require('electron');
global.app = electron.app;
global.request = electron.request;
global.BrowserWindow = electron.BrowserWindow;
global.Menu = electron.Menu;
global.Dialog = electron.dialog;
global.Fs = require('fs');
global.XLSX = require('xlsx');
global.ipc = require("electron").ipcMain;
global.utils = require('./main/utils');
global.datapackage = require('./main/datapackage');
global.github = require('./main/github');
global.schema = require('./main/schema');
global.excel = require('./main/excel');
global.fileActions = require('./main/file');
global.tools = require('./main/tools');
global.validate = require('./main/validate');
global.help = require('./main/help');
require('electron-debug')({showDevTools: true});
/*require('crash-reporter').start(
{
companyName: 'Open Data Institute'
}
);*/
var template = require('./main/menu').menu;
var mainWindow = null;
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
filename = null;
if (process.env.NODE_ENV === 'development') {
if (process.argv[2] && process.argv[2][0] !== '-') {
filename = process.argv[2];
}
} else {
if (process.argv[1] && process.argv[1][0] !== '-') {
filename = process.argv[1];
}
}
if (filename) {
fileActions.readFile([filename]);
} else {
utils.createWindow();
}
});