mirror of
https://github.com/marktext/marktext.git
synced 2025-05-17 17:30:31 +08:00
fix: #1382 portable application data directory
This commit is contained in:
parent
65d12af922
commit
132048d5f9
@ -1,4 +1,5 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { app } from 'electron'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import { isDirectory } from 'common/filesystem'
|
import { isDirectory } from 'common/filesystem'
|
||||||
import parseArgs from './parser'
|
import parseArgs from './parser'
|
||||||
@ -51,7 +52,7 @@ const cli = () => {
|
|||||||
// Check for portable mode and ensure the user data path is absolute. We assume
|
// 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.
|
// that the path is writable if not this lead to an application crash.
|
||||||
if (!args['--user-data-dir']) {
|
if (!args['--user-data-dir']) {
|
||||||
const portablePath = path.resolve('marktext-user-data')
|
const portablePath = path.join(app.getAppPath(), 'marktext-user-data')
|
||||||
if (isDirectory(portablePath)) {
|
if (isDirectory(portablePath)) {
|
||||||
args['--user-data-dir'] = portablePath
|
args['--user-data-dir'] = portablePath
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user