Skip to content

Commit

Permalink
Use suggested methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchangelWTF committed Jan 9, 2025
1 parent 72a2795 commit 2831e72
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions project/src/utils/JsonUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class JsonUtil {
this.fileHashes[filePath] = generatedHash;

if (writeHashes) {
await this.fileSystem.write(this.jsonCachePath, this.serialize(this.fileHashes, true));
await this.fileSystem.writeJson(this.jsonCachePath, this.fileHashes);
}

savedHash = generatedHash;
Expand All @@ -189,7 +189,11 @@ export class JsonUtil {
* Writes the file hashes to the cache path, to be used manually if writeHashes was set to false on deserializeWithCacheCheck
*/
public async writeCache(): Promise<void> {
await this.fileSystem.write(this.jsonCachePath, this.serialize(this.fileHashes, true));
if (!this.fileHashes) {
return;
}

await this.fileSystem.writeJson(this.jsonCachePath, this.fileHashes);
}

/**
Expand All @@ -213,7 +217,7 @@ export class JsonUtil {
protected async hydrateJsonCache(jsonCachePath: string): Promise<void> {
// Get all file hashes
if (!this.fileHashes) {
this.fileHashes = this.deserialize(await this.fileSystem.read(`${jsonCachePath}`));
this.fileHashes = await this.fileSystem.readJson(`${jsonCachePath}`);
}
}

Expand Down

0 comments on commit 2831e72

Please sign in to comment.