diff --git a/src/main/router/dir-router.ts b/src/main/router/dir-router.ts index 5d160961..abebabed 100644 --- a/src/main/router/dir-router.ts +++ b/src/main/router/dir-router.ts @@ -1,10 +1,8 @@ -import { Router } from '../lib/route-pass/Router'; -import { none, some } from '../lib/rust-like-utils-backend/Optional'; -import { dialog } from 'electron'; +import { Router } from "../lib/route-pass/Router"; +import { none, some } from "../lib/rust-like-utils-backend/Optional"; +import { dialog } from "electron"; import path from "path"; - - let waitList: ((dir: string) => void)[] = []; Router.respond("dir::select", () => { @@ -21,11 +19,18 @@ Router.respond("dir::select", () => { }); Router.respond("dir::autoGetOsuSongsDir", () => { - if (process.env.LOCALAPPDATA === undefined) { - return none(); + if (process.platform === "win32") { + if (process.env.LOCALAPPDATA === undefined) { + return none(); + } + return some(path.join(process.env.LOCALAPPDATA, "osu!", "Songs")); + } else if (process.platform === "linux") { + if (process.env.XDG_DATA_HOME === undefined) { + return none(); + } + return some(path.join(process.env.XDG_DATA_HOME, "osu-wine", "osu!", "Songs")); } - - return some(path.join(process.env.LOCALAPPDATA, "osu!", "Songs")); + return none(); }); Router.respond("dir::submit", (_evt, dir) => { @@ -36,10 +41,8 @@ Router.respond("dir::submit", (_evt, dir) => { waitList = []; }); - - export function dirSubmit(): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { waitList.push(resolve); }); -} \ No newline at end of file +}