fix: process user_stats.ini

This commit is contained in:
Zamitto 2024-10-05 20:24:35 -03:00
parent 2a6b757e37
commit 71e7f1ee58
3 changed files with 8 additions and 4 deletions

View File

@ -74,11 +74,10 @@ const iniParse = async (filePath: string) => {
object[objectName] = {};
} else {
const [name, ...value] = line.split("=");
object[objectName][name.trim()] = value.join("").trim();
object[objectName][name.trim()] = value.join("=").trim();
}
}
console.log("Parsed ini", object);
return object;
} catch {
return null;
@ -222,7 +221,7 @@ const processUserStats = (unlockedAchievements: any): UnlockedAchievement[] => {
if (!isNaN(unlockTime)) {
newUnlockedAchievements.push({
name: achievement,
name: achievement.replace(/"/g, ``),
unlockTime: unlockTime,
});
}

View File

@ -61,7 +61,8 @@ export const updateAllLocalUnlockedAchievements = async () => {
achievementsLogger.log(
"Achievement file for",
game.title,
achievementFile.filePath
achievementFile.filePath,
parsedAchievements
);
}

View File

@ -10,6 +10,10 @@ log.transports.file.resolvePathFn = (
return path.join(logsPath, "pythoninstance.txt");
}
if (message?.scope == "achievements") {
return path.join(logsPath, "achievements.txt");
}
if (message?.level === "error") {
return path.join(logsPath, "error.txt");
}