jan/electron/utils/path.ts
NamH 1bf4c1b621
feat: pre-populate Jan's /models folder (#796)
Signed-off-by: James <james@jan.ai>
Co-authored-by: James <james@jan.ai>
2023-12-01 18:03:51 +07:00

20 lines
483 B
TypeScript

import { join } from 'path'
import { app } from 'electron'
import { mkdir } from 'fs-extra'
export async function createUserSpace(): Promise<void> {
return mkdir(userSpacePath).catch(() => {})
}
export const userSpacePath = join(app.getPath('home'), 'jan')
export function getResourcePath() {
let appPath = join(app.getAppPath(), '..', 'app.asar.unpacked')
if (!app.isPackaged) {
// for development mode
appPath = join(__dirname, '..', '..')
}
return appPath
}