Now steamapps.json will be remade if it is corrupt
(thanks to user Shori from [REDACTED] for reporting the bug)
This commit is contained in:
parent
832ab8608f
commit
bf0d8c576f
@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="CheckStyle-IDEA-Module">
|
||||
<option name="configuration">
|
||||
<map />
|
||||
</option>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
|
@ -1,6 +1,7 @@
|
||||
package util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import kong.unirest.HttpResponse;
|
||||
import kong.unirest.Unirest;
|
||||
@ -47,6 +48,10 @@ public class SteamAppsListCache {
|
||||
System.err.println("File does not exist, trying to create steamapps.json for the first time...");
|
||||
//fileFound = false;
|
||||
sync();
|
||||
} catch (JsonSyntaxException e) {
|
||||
System.err.println("File seems to be corrupt, trying to recreate steamapps.json...");
|
||||
//fileFound = false;
|
||||
sync();
|
||||
}
|
||||
if (Instant.now().isAfter(list.getTimestamp().plus(Duration.ofDays(3)))) {
|
||||
System.err.println("List in file is not recent!");
|
||||
@ -115,7 +120,7 @@ public class SteamAppsListCache {
|
||||
System.out.println("Successfully saved SteamAppList to file (" + cacheFile.getAbsolutePath() + ")...");
|
||||
}
|
||||
|
||||
private void getListFromFile() throws FileNotFoundException {
|
||||
private void getListFromFile() throws FileNotFoundException, JsonSyntaxException {
|
||||
System.out.println("Trying to get SteamAppList from file (" + cacheFile.getAbsolutePath() + ")...");
|
||||
BufferedReader fIn = new BufferedReader(new FileReader(cacheFile));
|
||||
String json = fIn.lines().collect(Collectors.joining());
|
||||
|
Loading…
Reference in New Issue
Block a user