mirror of
https://github.com/Eugeny/tabby
synced 2024-12-12 22:32:57 +00:00
improve the launch performance of portable
This commit is contained in:
parent
e764b22698
commit
9b7c446fd7
4 changed files with 28 additions and 13 deletions
|
@ -35,6 +35,10 @@
|
|||
|
||||
---
|
||||
|
||||
# Portable
|
||||
|
||||
For portable in windows, user can create folder `data` at the same directory as `Terminal.exe` to save the settings.
|
||||
|
||||
# Plugins
|
||||
|
||||
Plugins and themes can be installed directly from the Settings view inside Terminus.
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
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)
|
||||
}
|
||||
let appPath: string | null = null
|
||||
try {
|
||||
appPath = path.dirname(require('electron').app.getPath('exe'))
|
||||
} catch {
|
||||
appPath = path.dirname(require('electron').remote.app.getPath('exe'))
|
||||
}
|
||||
|
||||
try {
|
||||
require('electron').app.setPath('userData', portableData)
|
||||
} catch {
|
||||
require('electron').remote.app.setPath('userData', portableData)
|
||||
if (null != appPath) {
|
||||
if(fs.existsSync(path.join(appPath, 'terminus-data'))) {
|
||||
fs.renameSync(path.join(appPath, 'terminus-data'), path.join(appPath, 'data'))
|
||||
}
|
||||
const portableData = path.join(appPath, 'data')
|
||||
if (fs.existsSync(portableData)) {
|
||||
console.log('reset user data to ' + portableData)
|
||||
try {
|
||||
require('electron').app.setPath('userData', portableData)
|
||||
} catch {
|
||||
require('electron').remote.app.setPath('userData', portableData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,16 @@ publish:
|
|||
|
||||
win:
|
||||
icon: "./build/windows/icon.ico"
|
||||
artifactName: terminus-${version}-setup.exe
|
||||
target: [
|
||||
'nsis',
|
||||
'zip'
|
||||
]
|
||||
artifactName: terminus-${version}.${ext}
|
||||
rfc3161TimeStampServer: http://sha256timestamp.ws.symantec.com/sha256/timestamp
|
||||
nsis:
|
||||
oneClick: false
|
||||
artifactName: terminus-${version}-setup.${ext}
|
||||
installerIcon: "./build/windows/icon.ico"
|
||||
portable:
|
||||
artifactName: terminus-${version}-portable.exe
|
||||
|
||||
mac:
|
||||
category: public.app-category.video
|
||||
|
|
|
@ -7,7 +7,7 @@ const isCI = !!process.env.GITHUB_REF
|
|||
|
||||
builder({
|
||||
dir: true,
|
||||
win: ['nsis', 'portable'],
|
||||
win: ['nsis', 'zip'],
|
||||
config: {
|
||||
extraMetadata: {
|
||||
version: vars.version,
|
||||
|
|
Loading…
Reference in a new issue