2020-02-03 12:59:46 +00:00
|
|
|
import * as path from 'path'
|
|
|
|
import * as fs from 'fs'
|
2021-03-20 16:12:39 +00:00
|
|
|
import * as electron from 'electron'
|
2020-02-03 12:59:46 +00:00
|
|
|
|
2021-03-20 16:12:39 +00:00
|
|
|
const appPath = path.dirname(electron.app.getPath('exe'))
|
2020-02-03 12:59:46 +00:00
|
|
|
|
2021-01-02 19:10:00 +00:00
|
|
|
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)
|
2021-03-20 16:12:39 +00:00
|
|
|
electron.app.setPath('userData', portableData)
|
2020-02-03 12:59:46 +00:00
|
|
|
}
|