mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: handle achievement parse error causing hydra to never search new achievements in real time
This commit is contained in:
parent
58cbf78fb9
commit
6f417d23d1
2 changed files with 127 additions and 133 deletions
|
@ -236,6 +236,7 @@ export class AchievementWatcherManager {
|
|||
};
|
||||
|
||||
public static preSearchAchievements = async () => {
|
||||
try {
|
||||
const newAchievementsCount =
|
||||
process.platform === "win32"
|
||||
? await this.preSearchAchievementsWindows()
|
||||
|
@ -255,6 +256,9 @@ export class AchievementWatcherManager {
|
|||
totalNewGamesWithAchievements
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
achievementsLogger.error("Error on preSearchAchievements", err);
|
||||
}
|
||||
|
||||
this.hasFinishedMergingWithRemote = true;
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ export const parseAchievementFile = (
|
|||
): UnlockedAchievement[] => {
|
||||
if (!existsSync(filePath)) return [];
|
||||
|
||||
try {
|
||||
if (type == Cracker.codex) {
|
||||
const parsed = iniParse(filePath);
|
||||
return processDefault(parsed);
|
||||
|
@ -78,10 +79,13 @@ export const parseAchievementFile = (
|
|||
`Unprocessed ${type} achievements found on ${filePath}`
|
||||
);
|
||||
return [];
|
||||
} catch (err) {
|
||||
achievementsLogger.error(`Error parsing ${type} - ${filePath}`, err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const iniParse = (filePath: string) => {
|
||||
try {
|
||||
const fileContent = readFileSync(filePath, "utf-8");
|
||||
|
||||
const lines =
|
||||
|
@ -105,23 +109,13 @@ const iniParse = (filePath: string) => {
|
|||
}
|
||||
|
||||
return object;
|
||||
} catch (err) {
|
||||
achievementsLogger.error(`Error parsing ${filePath}`, err);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
const jsonParse = (filePath: string) => {
|
||||
try {
|
||||
return JSON.parse(readFileSync(filePath, "utf-8"));
|
||||
} catch (err) {
|
||||
achievementsLogger.error(`Error parsing ${filePath}`, err);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
const processRazor1911 = (filePath: string): UnlockedAchievement[] => {
|
||||
try {
|
||||
const fileContent = readFileSync(filePath, "utf-8");
|
||||
|
||||
const lines =
|
||||
|
@ -143,10 +137,6 @@ const processRazor1911 = (filePath: string): UnlockedAchievement[] => {
|
|||
}
|
||||
|
||||
return achievements;
|
||||
} catch (err) {
|
||||
achievementsLogger.error(`Error processing ${filePath}`, err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const processOnlineFix = (unlockedAchievements: any): UnlockedAchievement[] => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue