Skip to content

Commit

Permalink
Update WeekData.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
Raltyro authored and CharlesCatYT committed Feb 3, 2024
1 parent 53374f9 commit 6ba4cfb
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions source/backend/WeekData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package backend;

import lime.utils.Assets;
import openfl.utils.Assets as OpenFlAssets;
import haxe.Json;

typedef WeekFile =
{
Expand Down Expand Up @@ -161,19 +160,13 @@ class WeekData {

private static function getWeekFile(path:String):WeekFile {
var rawJson:String = null;
#if MODS_ALLOWED
if(FileSystem.exists(path)) {
rawJson = File.getContent(path);
}
#else
if(OpenFlAssets.exists(path)) {
rawJson = Assets.getText(path);
}
#if sys
if (FileSystem.exists(path)) rawJson = File.getContent(path);
else
#end
if (OpenFlAssets.exists(path)) rawJson = Assets.getText(path);

if(rawJson != null && rawJson.length > 0) {
return cast tjson.TJSON.parse(rawJson);
}
if (rawJson != null && rawJson.length > 0) return cast tjson.TJSON.parse(rawJson);
return null;
}

Expand Down

0 comments on commit 6ba4cfb

Please sign in to comment.