diff --git a/app/lib/index.ts b/app/lib/index.ts index 58992ac3..d055d9b1 100644 --- a/app/lib/index.ts +++ b/app/lib/index.ts @@ -1,11 +1,10 @@ +import './portable' import './sentry' import './lru' import { app, ipcMain, Menu } from 'electron' import { parseArgs } from './cli' import { Application } from './app' import electronDebug = require('electron-debug') -import * as path from 'path' -import * as fs from 'fs' if (!process.env.TERMINUS_PLUGINS) { process.env.TERMINUS_PLUGINS = '' @@ -13,14 +12,6 @@ if (!process.env.TERMINUS_PLUGINS) { const application = new Application() -if (process.env.PORTABLE_EXECUTABLE_DIR) { - const portableData = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'terminus-data') - if (!fs.existsSync(portableData)) { - fs.mkdirSync(portableData) - } - app.setPath('userData', portableData) -} - ipcMain.on('app:new-window', () => { application.newWindow() }) diff --git a/app/lib/portable.ts b/app/lib/portable.ts new file mode 100755 index 00000000..31de6942 --- /dev/null +++ b/app/lib/portable.ts @@ -0,0 +1,15 @@ +import * as path from 'path' +import * as fs from 'fs' + +if (process.env.PORTABLE_EXECUTABLE_DIR) { + const portableData = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'terminus-data') + if (!fs.existsSync(portableData)) { + fs.mkdirSync(portableData) + } + + try { + require('electron').app.setPath('userData', portableData) + } catch { + require('electron').remote.app.setPath('userData', portableData) + } +} diff --git a/app/lib/sentry.ts b/app/lib/sentry.ts old mode 100644 new mode 100755 index 051381c8..649b9694 --- a/app/lib/sentry.ts +++ b/app/lib/sentry.ts @@ -1,21 +1,21 @@ -const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer') -import * as isDev from 'electron-is-dev' - - -const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876' -let release -try { - release = require('electron').app.getVersion() -} catch { - release = require('electron').remote.app.getVersion() -} - -if (!isDev) { - init({ - dsn: SENTRY_DSN, - release, - integrations (integrations) { - return integrations.filter(integration => integration.name !== 'Breadcrumbs') - }, - }) -} +const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer') +import * as isDev from 'electron-is-dev' + + +const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876' +let release +try { + release = require('electron').app.getVersion() +} catch { + release = require('electron').remote.app.getVersion() +} + +if (!isDev) { + init({ + dsn: SENTRY_DSN, + release, + integrations (integrations) { + return integrations.filter(integration => integration.name !== 'Breadcrumbs') + }, + }) +}