mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 03:31:24 +08:00
25 lines
523 B
TypeScript
25 lines
523 B
TypeScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
import { app } from 'electron'
|
|
|
|
export function getResourcePath() {
|
|
return path.join(app.getAppPath(), 'resources')
|
|
}
|
|
|
|
export function getDataPath() {
|
|
const dataPath = path.join(app.getPath('userData'), 'Data')
|
|
if (!fs.existsSync(dataPath)) {
|
|
fs.mkdirSync(dataPath, { recursive: true })
|
|
}
|
|
return dataPath
|
|
}
|
|
|
|
export function getInstanceName(baseURL: string) {
|
|
try {
|
|
return new URL(baseURL).host.split('.')[0]
|
|
} catch (error) {
|
|
return ''
|
|
}
|
|
}
|