fix: #1382 portable application data directory

This commit is contained in:
Felix Häusler 2019-09-28 03:13:52 +02:00
parent 65d12af922
commit 132048d5f9

View File

@ -1,4 +1,5 @@
import path from 'path'
import { app } from 'electron'
import os from 'os'
import { isDirectory } from 'common/filesystem'
import parseArgs from './parser'
@ -51,7 +52,7 @@ const cli = () => {
// Check for portable mode and ensure the user data path is absolute. We assume
// that the path is writable if not this lead to an application crash.
if (!args['--user-data-dir']) {
const portablePath = path.resolve('marktext-user-data')
const portablePath = path.join(app.getAppPath(), 'marktext-user-data')
if (isDirectory(portablePath)) {
args['--user-data-dir'] = portablePath
}