Skip to content

Commit

Permalink
fix: Update constants and paths for production and development enviro…
Browse files Browse the repository at this point in the history
…nments
  • Loading branch information
truemiller committed Jul 8, 2024
1 parent b561c72 commit 94d4e60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions electron/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ const ERROR_ADDRESS_IN_USE = 'EADDRINUSE';
const isWindows = process.platform === 'win32';
const isMac = process.platform === 'darwin';
const isLinux = process.platform === 'linux';
const isProd = process.env.NODE_ENV === 'production';
const isDev = !isProd;

module.exports = {
PORT_RANGE,
ERROR_ADDRESS_IN_USE,
isWindows,
isMac,
isLinux,
isProd,
isDev,
};
8 changes: 4 additions & 4 deletions electron/constants/paths.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const os = require('os');
const path = require('path');
const fs = require('fs');
const { isProd } = require('../constants');

const dotOperateDirectory =
process.env.NODE_ENV === 'production'
? path.join(os.homedir(), '.operate')
: '.operate';
const dotOperateDirectory = isProd
? path.join(os.homedir(), '.operate')
: '.operate';

// Create operate directory if it doesn't exist
if (!fs.existsSync(dotOperateDirectory)) {
Expand Down
2 changes: 1 addition & 1 deletion electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const { PORT_RANGE, isWindows, isMac } = require('./constants');
const { macUpdater } = require('./update');
const { setupStoreIpc } = require('./store');
const { logger } = require('./logger');
const { isDev } = require('./constants');

// Configure environment variables
dotenv.config();
Expand All @@ -37,7 +38,6 @@ const singleInstanceLock = app.requestSingleInstanceLock();
if (!singleInstanceLock) app.quit();

const platform = os.platform();
const isDev = process.env.NODE_ENV === 'development';

const binaryPaths = {
darwin: {
Expand Down

0 comments on commit 94d4e60

Please sign in to comment.