@lvce-editor/main-process 6.30.0 → 6.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -754,19 +754,6 @@ function unhandled(inputOptions) {
754
754
  }
755
755
  }
756
756
 
757
- const setUserDataPath = value => {
758
- app.setPath('userData', value);
759
- };
760
- const setSessionDataPath = value => {
761
- app.setPath('sessionData', value);
762
- };
763
- const setCrashDumpsPath = value => {
764
- app.setPath('crashDumps', value);
765
- };
766
- const setLogsPath = value => {
767
- app.setPath('logs', value);
768
- };
769
-
770
757
  const Success = 0;
771
758
  const Error$3 = 1;
772
759
 
@@ -800,13 +787,16 @@ const homeDirectory = homedir();
800
787
 
801
788
  const xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? join(homeDirectory, '.cache') : undefined);
802
789
  const xdgConfig = env.XDG_CONFIG_HOME || (homeDirectory ? join(homeDirectory, '.config') : undefined);
790
+ const configDir = join(xdgConfig || tmpdir(), applicationName);
803
791
  const xdgData = env.XDG_DATA_HOME || (homeDirectory ? join(homeDirectory, '.local', 'share') : undefined);
804
792
  join(xdgData || tmpdir(), applicationName);
805
793
  const xdgState = env.XDG_STATE_HOME || (homeDirectory ? join(homeDirectory, '.local', 'state') : undefined);
806
794
  const logsDir = join(xdgState || tmpdir(), applicationName, 'logs');
807
- const chromeUserDataPath = xdgCache ? join(xdgCache, applicationName, 'userdata') : '';
795
+ const electronUserDataPath = join(configDir, 'electron');
796
+ const crashDumpsPath = join(electronUserDataPath, 'Crashpad');
797
+ const electronSessionDataPath = join(xdgCache || tmpdir(), applicationName, 'userdata');
808
798
  const getArgvConfigPath = () => {
809
- return join(xdgConfig || tmpdir(), applicationName, 'argv.json');
799
+ return join(configDir, 'argv.json');
810
800
  };
811
801
 
812
802
  const useIpcForResponse = true;
@@ -4230,7 +4220,7 @@ const requestSingleInstanceLock = argv => {
4230
4220
  // currently launching shared process takes 170ms
4231
4221
  // which means first paint is delayed by a lot
4232
4222
 
4233
- const hydrate = async (isLinux, chromeUserDataPath, argv) => {
4223
+ const hydrate = async argv => {
4234
4224
  setMenu(null); // performance
4235
4225
  unhandled({
4236
4226
  logger() {},
@@ -4254,12 +4244,6 @@ const hydrate = async (isLinux, chromeUserDataPath, argv) => {
4254
4244
  await handleFastCliArgs(moduleId, parsedCliArgs);
4255
4245
  return;
4256
4246
  }
4257
- if (isLinux && chromeUserDataPath) {
4258
- setUserDataPath(chromeUserDataPath);
4259
- setSessionDataPath(chromeUserDataPath);
4260
- setCrashDumpsPath(chromeUserDataPath);
4261
- setLogsPath(chromeUserDataPath);
4262
- }
4263
4247
  if (!isPromptMode$1) {
4264
4248
  const hasLock = requestSingleInstanceLock(argv);
4265
4249
  if (!hasLock) {
@@ -4293,6 +4277,23 @@ const hydrate = async (isLinux, chromeUserDataPath, argv) => {
4293
4277
  await handleReady(parsedCliArgs, cwd());
4294
4278
  };
4295
4279
 
4280
+ const configure = ({
4281
+ crashDumpsPath,
4282
+ logsPath,
4283
+ sessionDataPath,
4284
+ userDataPath
4285
+ }) => {
4286
+ for (const path of [crashDumpsPath, logsPath, sessionDataPath, userDataPath]) {
4287
+ mkdirSync(path, {
4288
+ recursive: true
4289
+ });
4290
+ }
4291
+ app.setPath('userData', userDataPath);
4292
+ app.setPath('sessionData', sessionDataPath);
4293
+ app.setPath('crashDumps', crashDumpsPath);
4294
+ app.setPath('logs', logsPath);
4295
+ };
4296
+
4296
4297
  const {
4297
4298
  argv
4298
4299
  } = process;
@@ -7600,6 +7601,14 @@ const setStackTraceLimit = value => {
7600
7601
  // @ts-ignore
7601
7602
  performance.mark('code/start');
7602
7603
  const main = async () => {
7604
+ if (isLinux) {
7605
+ configure({
7606
+ crashDumpsPath: crashDumpsPath,
7607
+ logsPath: logsDir,
7608
+ sessionDataPath: electronSessionDataPath,
7609
+ userDataPath: electronUserDataPath
7610
+ });
7611
+ }
7603
7612
  const configArguments = await load(getArgvConfigPath());
7604
7613
  prepend(configArguments);
7605
7614
  Object.assign(commandMapRef, commandMap);
@@ -7607,7 +7616,7 @@ const main = async () => {
7607
7616
  on$1('uncaughtExceptionMonitor', handleUncaughtExceptionMonitor);
7608
7617
  // workaround for https://github.com/electron/electron/issues/36526
7609
7618
  on$1('unhandledRejection', handleUnhandledRejection);
7610
- await hydrate(isLinux, chromeUserDataPath, argv);
7619
+ await hydrate(argv);
7611
7620
  };
7612
7621
 
7613
7622
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.30.0",
3
+ "version": "6.30.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"