mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-30 02:54:04 +03:00
25 lines
773 B
TypeScript
Executable File
25 lines
773 B
TypeScript
Executable File
import * as path from 'path'
|
|
import * as fs from 'fs'
|
|
|
|
let appPath: string | null = null
|
|
try {
|
|
appPath = path.dirname(require('electron').app.getPath('exe'))
|
|
} catch {
|
|
appPath = path.dirname(require('electron').remote.app.getPath('exe'))
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|