feat: adding dynamic dir to get steam user id

This commit is contained in:
Chubby Granny Chaser
2025-05-13 23:38:47 +01:00
parent 66ced3c779
commit f0c5ec6f1a
2 changed files with 6 additions and 8 deletions

View File

@@ -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");

View File

@@ -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) {