@@ -9,24 +9,6 @@ import { parseRaw } from './lib/heightmap';
99import { resourceRoot } from './lib/app' ;
1010import { dataCache , smoothTerrainData } from './lib/terrain' ;
1111
12- const basePath = 'brian/react-devtools' ;
13- const reactDevToolsPath = path . join ( resourceRoot ( ) , basePath ) ;
14-
15- // let formContext = {
16- // layers: [],
17- // svg: null,
18- // raw: null
19- // };
20- // let palette;
21-
22- // const logPreload = path.join(resourceRoot(), 'electron-log-preload.js');
23- // console.log('logPreload', logPreload);
24-
25- // log.initialize();
26-
27- // let svgState = { layers: [], svg: null };
28- // let rawState = { raw: null };
29-
3012// Handle creating/removing shortcuts on Windows when installing/uninstalling.
3113if ( require ( 'electron-squirrel-startup' ) ) {
3214 app . quit ( ) ;
@@ -59,22 +41,18 @@ const createWindow = async () => {
5941 mainWindow . webContents . openDevTools ( ) ;
6042} ;
6143
62- // This method will be called when Electron has finished
63- // initialization and is ready to create browser windows.
64- // Some APIs can only be used after this event occurs.
6544app . whenReady ( ) . then ( async ( ) => {
66- // try {
67- // palette = await parsePalette();
68- // } catch (error) {
69- // log.error('Unable to load color palette', error);
70- // }
71-
72- const ext = await session . defaultSession . extensions . loadExtension (
73- reactDevToolsPath , { allowFileAccess : true }
74- ) ;
75- console . log ( 'ext' , ext ) ;
45+
46+ if ( process . env . REACT_DEVTOOLS ) {
47+ const ext = await session . defaultSession . extensions . loadExtension (
48+ process . env . REACT_DEVTOOLS , { allowFileAccess : true }
49+ ) ;
50+ if ( ext ?. version ) {
51+ log . info ( `Loaded dev tools extension: ${ ext ?. version } ` ) ;
52+ }
53+ }
54+
7655 createWindow ( ) ;
77- // const ext = await session.defaultSession.loadExtension(reactDevToolsPath, { allowFileAccess: false });
7856
7957 // On OS X it's common to re-create a window in the app when the
8058 // dock icon is clicked and there are no other windows open.
@@ -139,17 +117,6 @@ ipcMain.handle('url.open', async (_, href) => {
139117 }
140118} ) ;
141119
142- // ipcMain.handle('svg.clear', async () => {
143- // formContext = {
144- // ...formContext,
145- // layers: [],
146- // svg: null,
147- // height: null,
148- // width: null
149- // };
150- // return formContext;
151- // });
152-
153120ipcMain . handle ( 'raw.select' , async ( event , layer ) => {
154121 const result = await dialog . showOpenDialog ( {
155122 title : 'Select RAW File' ,
0 commit comments