Skip to content

Commit

Permalink
Merge pull request #89 from taozhiyu/main
Browse files Browse the repository at this point in the history
fix: error desktop path
  • Loading branch information
LokerL authored Mar 16, 2023
2 parents 8e3496a + 15da2e2 commit fde0d05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,8 @@ ipcMain.on("openDevTools", async (event, arg) => {
win.webContents.openDevTools({ mode: "undocked", activate: true });
}
});

// Get desktop path
ipcMain.on("getDesktopPath", async (event) => {
event.returnValue = app.getPath("desktop");
});
5 changes: 2 additions & 3 deletions src/global/initLocalStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const Store = require("electron-store");
const store = new Store();
const homeDir = require("os").homedir();
const desktopDir = require("path").resolve(homeDir, "Desktop");
const { ipcRenderer } = require("electron");
export default function initStore() {
if (!store.has("FormConfig.默认")) {
store.set("FormConfig.默认", {
Expand All @@ -14,7 +13,7 @@ export default function initStore() {
});
}
if (!store.has("savePath")) {
store.set("savePath", desktopDir);
store.set("savePath", ipcRenderer.sendSync("getDesktopPath"));
}
if (!store.has("audition")) {
store.set(
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"ignoreDeprecations": "5.0",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
Expand Down

0 comments on commit fde0d05

Please sign in to comment.