diff --git a/src/main/events/library/create-steam-shortcut.ts b/src/main/events/library/create-steam-shortcut.ts index f0a27670..b702bc08 100644 --- a/src/main/events/library/create-steam-shortcut.ts +++ b/src/main/events/library/create-steam-shortcut.ts @@ -54,7 +54,7 @@ const createSteamShortcut = async ( `/games/stats?objectId=${objectId}&shop=${shop}` ); - const steamUserId = getSteamUserId(); + const steamUserId = await getSteamUserId(); if (!steamUserId) { logger.error("No Steam user ID found"); diff --git a/src/main/services/steam.ts b/src/main/services/steam.ts index fff87422..d805de4b 100644 --- a/src/main/services/steam.ts +++ b/src/main/services/steam.ts @@ -77,14 +77,12 @@ export const getSteamAppDetails = async ( }); }; -export const getSteamUserId = () => { - const userDataPath = path.join( - SystemPath.getPath("appData"), - "Steam", - "userdata" - ); +export const getSteamUserId = async () => { + const userDataPath = await getSteamLocation(); - const userIds = fs.readdirSync(userDataPath, { withFileTypes: true }); + const userIds = fs.readdirSync(path.join(userDataPath, "userdata"), { + withFileTypes: true, + }); const [steamUserId] = userIds.filter((dir) => dir.isDirectory()); if (!steamUserId) {