Fix: sentry will use userData before redirect it, ahead of the time

This commit is contained in:
Cyril Taylor
2020-02-03 20:59:46 +08:00
parent d89abde860
commit 1027fbfb60
3 changed files with 37 additions and 31 deletions

15
app/lib/portable.ts Executable file
View File

@@ -0,0 +1,15 @@
import * as path from 'path'
import * as fs from 'fs'
if (process.env.PORTABLE_EXECUTABLE_DIR) {
const portableData = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'terminus-data')
if (!fs.existsSync(portableData)) {
fs.mkdirSync(portableData)
}
try {
require('electron').app.setPath('userData', portableData)
} catch {
require('electron').remote.app.setPath('userData', portableData)
}
}