fulcrumapp / fulcrum-desktop

Fulcrum Desktop
http://developer.fulcrumapp.com/desktop/intro/
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

Customization of Location of where Fulcrum DB is installed #85

Open juice-1234 opened 1 year ago

juice-1234 commented 1 year ago

currently the location changes depending on which OS you run see code snippet below having this location customisable would be extremely useful as then control of which drive and folder location the database is stored is easily changed

/*
 *  Windows: %LOCALAPPDATA%
 *  macOS:   ~/Library/Application Support
 *  Linux:   ~/.config
 */

let appData = '';
let userData = '';

const APPNAME = 'Fulcrum';

if (process.platform === 'win32') {
  appData = process.env.LOCALAPPDATA;
} else if (process.platform === 'darwin') {
  appData = _path2.default.join(_os2.default.homedir(), 'Library', 'Application Support');
} else {
  appData = process.env.XDG_CONFIG_HOME || _path2.default.join(_os2.default.homedir(), '.config');
}

would it be possible to insert a line here to allow for a custom location based on if an environmental variable was set for example

/*
 *  Windows: %LOCALAPPDATA%
 *  macOS:   ~/Library/Application Support
 *  Linux:   ~/.config
 */

let appData = '';
let userData = '';

/* if environment variable "fulcrum" exists use this location as DB storage location 
   else use default appdata based on OS

*/
const APPNAME = 'Fulcrum';
if exists(process.env.fulcrum){ 
 appdata=process.env.fulcrum
}
else{
  if (process.platform === 'win32') {
    appData = process.env.LOCALAPPDATA;
  } else if (process.platform === 'darwin') {
    appData = _path2.default.join(_os2.default.homedir(), 'Library', 'Application Support');
  } else {
    appData = process.env.XDG_CONFIG_HOME || _path2.default.join(_os2.default.homedir(), '.config');
  }
}