Skip to content

Commit

Permalink
Merge pull request #1424 from yaklang/fix/yakit-home-path
Browse files Browse the repository at this point in the history
fix: mac and linux reset home path
  • Loading branch information
luoluoTH authored Feb 5, 2024
2 parents 9f502a7 + 8130ce6 commit 7ac18fe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/main/filePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ const path = require("path")
const process = require("process")
const fs = require("fs")
/** 软件根目录 */
const appPath = app.isPackaged ? path.dirname(app.getPath('exe')) : app.getAppPath();
const appPath = app.isPackaged ? path.dirname(app.getPath("exe")) : app.getAppPath()
/** 软件关联项目相关目录路径 */
/** 优先使用家目录下的yakit-projects
* 在新版本中,windows自定义安装路径会将家目录的yakit-projects迁移到软件根目录下,则会使用该目录 */
const defaultYakitProjectPath = path.join(os.homedir(), "yakit-projects")
const YakitProjectPath = fs.existsSync(defaultYakitProjectPath)? defaultYakitProjectPath: process.env.YAKIT_HOME || path.join(appPath, "yakit-projects");
const YakitProjectPath =
process.platform === "win32"
? fs.existsSync(defaultYakitProjectPath)
? defaultYakitProjectPath
: process.env.YAKIT_HOME || path.join(appPath, "yakit-projects")
: defaultYakitProjectPath

/** 引擎和软件安装包路径 */
const yaklangEngineDir = path.join(YakitProjectPath, "yak-engine")
Expand Down

0 comments on commit 7ac18fe

Please sign in to comment.