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] = {}; object[objectName] = {};
} else { } else {
const [name, ...value] = line.split("="); 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; return object;
} catch { } catch {
return null; return null;
@ -222,7 +221,7 @@ const processUserStats = (unlockedAchievements: any): UnlockedAchievement[] => {
if (!isNaN(unlockTime)) { if (!isNaN(unlockTime)) {
newUnlockedAchievements.push({ newUnlockedAchievements.push({
name: achievement, name: achievement.replace(/"/g, ``),
unlockTime: unlockTime, unlockTime: unlockTime,
}); });
} }

View File

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

View File

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