mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-15 06:30:13 +08:00
Merge pull request #2000 from CyrilTaylor/dev/portable/userData_location
set userData location to the 'data' folder which at the same level as the Terminus executable directory if exist with portable mode
This commit is contained in:
commit
472b421484
@ -4,6 +4,8 @@ import { app, ipcMain, Menu } from 'electron'
|
|||||||
import { parseArgs } from './cli'
|
import { parseArgs } from './cli'
|
||||||
import { Application } from './app'
|
import { Application } from './app'
|
||||||
import electronDebug = require('electron-debug')
|
import electronDebug = require('electron-debug')
|
||||||
|
import * as path from 'path'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
|
||||||
if (!process.env.TERMINUS_PLUGINS) {
|
if (!process.env.TERMINUS_PLUGINS) {
|
||||||
process.env.TERMINUS_PLUGINS = ''
|
process.env.TERMINUS_PLUGINS = ''
|
||||||
@ -11,6 +13,17 @@ if (!process.env.TERMINUS_PLUGINS) {
|
|||||||
|
|
||||||
const application = new Application()
|
const application = new Application()
|
||||||
|
|
||||||
|
const portableData = path.join(`${process.env.PORTABLE_EXECUTABLE_DIR}`, 'data')
|
||||||
|
if (('PORTABLE_EXECUTABLE_DIR' in process.env) && fs.existsSync(portableData)) {
|
||||||
|
fs.stat(portableData, (err, stats) => {
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
app.setPath('userData' ,portableData)
|
||||||
|
} else {
|
||||||
|
console.warn(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
ipcMain.on('app:new-window', () => {
|
ipcMain.on('app:new-window', () => {
|
||||||
application.newWindow()
|
application.newWindow()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user