You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-10 22:11:50 +02:00
This commit is contained in:
@@ -8,8 +8,8 @@ import { urlDecode } from '@joplin/lib/string-utils';
|
|||||||
import * as Sentry from '@sentry/electron/main';
|
import * as Sentry from '@sentry/electron/main';
|
||||||
import { homedir } from 'os';
|
import { homedir } from 'os';
|
||||||
import { msleep } from '@joplin/utils/time';
|
import { msleep } from '@joplin/utils/time';
|
||||||
import { pathExists, pathExistsSync, writeFileSync } from 'fs-extra';
|
import { pathExists, pathExistsSync, writeFileSync, ensureDirSync } from 'fs-extra';
|
||||||
import { extname, normalize } from 'path';
|
import { extname, normalize, join } from 'path';
|
||||||
import isSafeToOpen from './utils/isSafeToOpen';
|
import isSafeToOpen from './utils/isSafeToOpen';
|
||||||
import { closeSync, openSync, readSync, statSync } from 'fs';
|
import { closeSync, openSync, readSync, statSync } from 'fs';
|
||||||
import { KB } from '@joplin/utils/bytes';
|
import { KB } from '@joplin/utils/bytes';
|
||||||
@@ -67,6 +67,30 @@ export class Bridge {
|
|||||||
this.logFilePath_ = v;
|
this.logFilePath_ = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getCrashDumpDirectory(): string {
|
||||||
|
try {
|
||||||
|
const platformName = shim.platformName();
|
||||||
|
switch (platformName) {
|
||||||
|
case 'win32':
|
||||||
|
// Windows: Use %LOCALAPPDATA%\CrashDumps
|
||||||
|
return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), 'CrashDumps');
|
||||||
|
case 'darwin':
|
||||||
|
// macOS: Use ~/Library/Logs/DiagnosticReports
|
||||||
|
return join(homedir(), 'Library', 'Logs', 'DiagnosticReports');
|
||||||
|
case 'linux':
|
||||||
|
// Linux: Use XDG_STATE_HOME (for logs) or fallback to ~/.local/state
|
||||||
|
return join(process.env.XDG_STATE_HOME || join(homedir(), '.local', 'state'), 'joplin');
|
||||||
|
default:
|
||||||
|
// For unknown platforms, default to the home directory
|
||||||
|
return homedir();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// If we can't get the platform name, fallback to the home directory
|
||||||
|
return homedir();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private sentryInit() {
|
private sentryInit() {
|
||||||
const getLogLines = () => {
|
const getLogLines = () => {
|
||||||
try {
|
try {
|
||||||
@@ -109,7 +133,10 @@ export class Bridge {
|
|||||||
log: logAttachment ? logAttachment.data.trim().split('\n') : [],
|
log: logAttachment ? logAttachment.data.trim().split('\n') : [],
|
||||||
};
|
};
|
||||||
|
|
||||||
writeFileSync(`${homedir()}/joplin_crash_dump_${date}.json`, JSON.stringify(errorEventWithLog, null, '\t'), 'utf-8');
|
const crashDumpDir = this.getCrashDumpDirectory();
|
||||||
|
ensureDirSync(crashDumpDir);
|
||||||
|
const crashDumpPath = join(crashDumpDir, `joplin_crash_dump_${date}.json`);
|
||||||
|
writeFileSync(crashDumpPath, JSON.stringify(errorEventWithLog, null, '\t'), 'utf-8');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Ignore the error since we can't handle it here
|
// Ignore the error since we can't handle it here
|
||||||
}
|
}
|
||||||
|
@@ -195,3 +195,4 @@ orderedmap
|
|||||||
labelledby
|
labelledby
|
||||||
isTextblock
|
isTextblock
|
||||||
deflt
|
deflt
|
||||||
|
LOCALAPPDATA
|
@@ -17,7 +17,7 @@ Make sure you disable debugging once you've finished. Leaving it enabled can cau
|
|||||||
|
|
||||||
### Crash reports
|
### Crash reports
|
||||||
|
|
||||||
When the application crashes, a report is created in your [home directory](https://github.com/laurent22/joplin/blob/dev/readme/apps/home_directory.md) under the name `joplin_crash_dump_<DATE_TIME>.json`. If you experience a crash please share this log with the team by posting it to the [forum](https://discourse.joplinapp.org/), [GitHub](https://github.com/laurent22/joplin/issues) or [by email](https://raw.githubusercontent.com/laurent22/joplin/dev/Assets/AdresseSupport.png). You may also enable crash report auto-upload in the [Configuration screen](https://github.com/laurent22/joplin/blob/dev/readme/apps/config_screen.md) in the "Application" section.
|
When the application crashes, a report is created in your [crash report directory](https://github.com/laurent22/joplin/blob/dev/readme/apps/home_directory.md) under the name `joplin_crash_dump_<DATE_TIME>.json`. If you experience a crash please share this log with the team by posting it to the [forum](https://discourse.joplinapp.org/), [GitHub](https://github.com/laurent22/joplin/issues) or [by email](https://raw.githubusercontent.com/laurent22/joplin/dev/Assets/AdresseSupport.png). You may also enable crash report auto-upload in the [Configuration screen](https://github.com/laurent22/joplin/blob/dev/readme/apps/config_screen.md) in the "Application" section.
|
||||||
|
|
||||||
### Safe mode
|
### Safe mode
|
||||||
|
|
||||||
|
@@ -6,4 +6,14 @@ Joplin stores some data in your home directory, such as your profile and certain
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| Windows | `C:\\Users\\(username)` | `%UserProfile%` |
|
| Windows | `C:\\Users\\(username)` | `%UserProfile%` |
|
||||||
| Linux | `/home/(username)` | `$HOME` |
|
| Linux | `/home/(username)` | `$HOME` |
|
||||||
| macOS | `/Users/(Username)` | `$HOME` |
|
| macOS | `/Users/(Username)` | `$HOME` |
|
||||||
|
|
||||||
|
## Crash report directory
|
||||||
|
|
||||||
|
When Joplin crashes, it generates a crash report that can help diagnose the issue. The location of these crash reports varies by operating system:
|
||||||
|
|
||||||
|
| Operating System | Path | Environment Variable |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Windows | `C:\\Users\\(username)\\AppData\\Local\\CrashDumps` | `%LocalAppData%\CrashDumps` |
|
||||||
|
| Linux | `/home/(username)/.local/state/joplin` | `$XDG_STATE_HOME/joplin` |
|
||||||
|
| macOS | `/Users/(Username)/Library/Logs/DiagnosticReports` | `$HOME/Library/Logs/DiagnosticReports` |
|
Reference in New Issue
Block a user