mirror of
https://github.com/Eugeny/tabby.git
synced 2025-08-14 21:31:51 +00:00
.github
.vscode
app
assets
lib
app.ts
cli.ts
config.ts
index.ts
lru.ts
pluginManager.ts
portable.ts
pty.ts
sentry.ts
stringDecoder.ts
utfSplitter.ts
window.ts
src
dev-app-update.yml
index.pug
package.json
tsconfig.json
tsconfig.main.json
webpack.config.js
webpack.main.config.js
yarn.lock
build
docs
extras
patches
scripts
snap
tabby-community-color-schemes
tabby-core
tabby-electron
tabby-local
tabby-plugin-manager
tabby-serial
tabby-settings
tabby-ssh
tabby-telnet
tabby-terminal
tabby-uac
tabby-web
tabby-web-demo
web
.all-contributorsrc
.eslintrc.yml
.gitignore
.mergify.yml
.pug-lintrc.js
CODE_OF_CONDUCT.md
HACKING.md
LICENSE
README.ko-KR.md
README.md
appveyor.yml
electron-builder.yml
firebase.json
package.json
tsconfig.json
typedoc.js
webpack.config.js
webpack.plugin.config.js
yarn.lock
27 lines
844 B
TypeScript
27 lines
844 B
TypeScript
import * as fs from 'fs'
|
|
import * as path from 'path'
|
|
import * as yaml from 'js-yaml'
|
|
import { app } from 'electron'
|
|
|
|
export function migrateConfig (): void {
|
|
const configPath = path.join(app.getPath('userData'), 'config.yaml')
|
|
const legacyConfigPath = path.join(app.getPath('userData'), '../terminus', 'config.yaml')
|
|
if (fs.existsSync(legacyConfigPath) && (
|
|
!fs.existsSync(configPath) ||
|
|
fs.statSync(configPath).mtime < fs.statSync(legacyConfigPath).mtime
|
|
)) {
|
|
fs.writeFileSync(configPath, fs.readFileSync(legacyConfigPath))
|
|
}
|
|
}
|
|
|
|
export function loadConfig (): any {
|
|
migrateConfig()
|
|
|
|
const configPath = path.join(app.getPath('userData'), 'config.yaml')
|
|
if (fs.existsSync(configPath)) {
|
|
return yaml.load(fs.readFileSync(configPath, 'utf8'))
|
|
} else {
|
|
return {}
|
|
}
|
|
}
|