feat(desktop): ✨ 实现MD文件模板导出方式
This commit is contained in:
@@ -30,6 +30,7 @@ export interface IUserReadingPersona {
|
||||
stats: {
|
||||
totalWords: number // 累计生成的心得总字数
|
||||
totalBooks: number // 累计阅读并生成过心得的书籍总数
|
||||
totalHours: number // 累计阅读并生成过心得的总时长
|
||||
topKeywords: string[] // 出现频率最高的 Top 10 关键词
|
||||
mostUsedOccupation: string // 最常使用的阅读者身份
|
||||
}
|
||||
|
||||
20
src/shared/utils/path.ts
Normal file
20
src/shared/utils/path.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { app } from 'electron'
|
||||
import path from 'path'
|
||||
|
||||
export const getResourcesPath = () => {
|
||||
const isDev = !app.isPackaged
|
||||
// 开发环境指向根目录 resources,生产环境指向 process.resourcesPath
|
||||
return isDev ? path.join(app.getAppPath(), 'resources') : process.resourcesPath
|
||||
}
|
||||
|
||||
export const getTemplatePath = (fileName: string) => {
|
||||
// 开发环境下,指向项目根目录下的 resources/templates
|
||||
// 生产环境下,指向 process.resourcesPath (即安装目录下的 resources 文件夹)
|
||||
const isDev = !app.isPackaged
|
||||
|
||||
const baseDir = isDev
|
||||
? path.join(app.getAppPath(), 'resources', 'templates')
|
||||
: path.join(process.resourcesPath, 'templates')
|
||||
|
||||
return path.join(baseDir, fileName)
|
||||
}
|
||||
Reference in New Issue
Block a user