Fix crash report location on Windows
This commit is contained in:
parent
26421b8c18
commit
1a313b88f8
|
@ -10,10 +10,18 @@ import * as Errors from '../ts/types/errors';
|
||||||
import { isProduction } from '../ts/util/version';
|
import { isProduction } from '../ts/util/version';
|
||||||
import { upload as uploadDebugLog } from '../ts/logging/uploadDebugLog';
|
import { upload as uploadDebugLog } from '../ts/logging/uploadDebugLog';
|
||||||
import { SignalService as Proto } from '../ts/protobuf';
|
import { SignalService as Proto } from '../ts/protobuf';
|
||||||
|
import * as OS from '../ts/OS';
|
||||||
|
|
||||||
async function getPendingDumps(): Promise<ReadonlyArray<string>> {
|
async function getPendingDumps(): Promise<ReadonlyArray<string>> {
|
||||||
const crashDumpsPath = await realpath(app.getPath('crashDumps'));
|
const crashDumpsPath = await realpath(app.getPath('crashDumps'));
|
||||||
const pendingDir = join(crashDumpsPath, 'pending');
|
let pendingDir: string;
|
||||||
|
if (OS.isWindows()) {
|
||||||
|
pendingDir = join(crashDumpsPath, 'reports');
|
||||||
|
} else {
|
||||||
|
// macOS and Linux
|
||||||
|
pendingDir = join(crashDumpsPath, 'pending');
|
||||||
|
}
|
||||||
|
|
||||||
const files = await readdir(pendingDir);
|
const files = await readdir(pendingDir);
|
||||||
|
|
||||||
return files.map(file => join(pendingDir, file));
|
return files.map(file => join(pendingDir, file));
|
||||||
|
@ -38,7 +46,7 @@ async function eraseDumps(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setup(getLogger: () => LoggerType): void {
|
export async function setup(getLogger: () => LoggerType): Promise<void> {
|
||||||
const isEnabled = !isProduction(app.getVersion());
|
const isEnabled = !isProduction(app.getVersion());
|
||||||
|
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
|
|
|
@ -325,6 +325,7 @@ function prepareUrl(
|
||||||
userDataPath: app.getPath('userData'),
|
userDataPath: app.getPath('userData'),
|
||||||
downloadsPath: app.getPath('downloads'),
|
downloadsPath: app.getPath('downloads'),
|
||||||
homePath: app.getPath('home'),
|
homePath: app.getPath('home'),
|
||||||
|
crashDumpsPath: app.getPath('crashDumps'),
|
||||||
...moreKeys,
|
...moreKeys,
|
||||||
}).href;
|
}).href;
|
||||||
}
|
}
|
||||||
|
@ -1401,11 +1402,14 @@ function getAppLocale(): string {
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
let ready = false;
|
let ready = false;
|
||||||
app.on('ready', async () => {
|
app.on('ready', async () => {
|
||||||
const userDataPath = await realpath(app.getPath('userData'));
|
const [userDataPath, crashDumpsPath] = await Promise.all([
|
||||||
|
realpath(app.getPath('userData')),
|
||||||
|
realpath(app.getPath('crashDumps')),
|
||||||
|
]);
|
||||||
|
|
||||||
logger = await logging.initialize(getMainWindow);
|
logger = await logging.initialize(getMainWindow);
|
||||||
|
|
||||||
setupCrashReports(getLogger);
|
await setupCrashReports(getLogger);
|
||||||
|
|
||||||
if (!locale) {
|
if (!locale) {
|
||||||
const appLocale = getAppLocale();
|
const appLocale = getAppLocale();
|
||||||
|
@ -1451,6 +1455,7 @@ app.on('ready', async () => {
|
||||||
const installPath = await realpath(app.getAppPath());
|
const installPath = await realpath(app.getAppPath());
|
||||||
|
|
||||||
addSensitivePath(userDataPath);
|
addSensitivePath(userDataPath);
|
||||||
|
addSensitivePath(crashDumpsPath);
|
||||||
|
|
||||||
if (getEnvironment() !== Environment.Test) {
|
if (getEnvironment() !== Environment.Test) {
|
||||||
installFileHandler({
|
installFileHandler({
|
||||||
|
|
|
@ -436,6 +436,9 @@ try {
|
||||||
const { addSensitivePath } = require('./ts/util/privacy');
|
const { addSensitivePath } = require('./ts/util/privacy');
|
||||||
|
|
||||||
addSensitivePath(window.baseAttachmentsPath);
|
addSensitivePath(window.baseAttachmentsPath);
|
||||||
|
if (config.crashDumpsPath) {
|
||||||
|
addSensitivePath(config.crashDumpsPath);
|
||||||
|
}
|
||||||
|
|
||||||
window.Signal = Signal.setup({
|
window.Signal = Signal.setup({
|
||||||
Attachments,
|
Attachments,
|
||||||
|
|
Loading…
Reference in New Issue