Skip to content

Commit a684501

Browse files
committed
Update HealthIcon.hx
1 parent 898313e commit a684501

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

source/objects/HealthIcon.hx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HealthIcon extends FlxSprite
4646
if(!Paths.fileExists('images/' + name + '.png', IMAGE)) name = 'icons/icon-face'; //Prevents crash from missing icon
4747
var file:Dynamic = Paths.image(name);
4848

49-
var jsonPath:String = name;
49+
var jsonPath:String = haxe.io.Path.directory(Paths.file('images/icons/icons/'));
5050
var jsonData:Dynamic = null;
5151

5252
// Try to load JSON file
@@ -83,8 +83,10 @@ class HealthIcon extends FlxSprite
8383
case WINNING: 'WINNING';
8484
}};
8585
if (!sys.FileSystem.exists(jsonPath)) {
86-
var file = sys.io.File.write(jsonPath, true); // ???
87-
file.close();
86+
try {
87+
var file = sys.io.File.write(jsonPath, true); // ???
88+
file.close();
89+
} catch(e) {trace("Failed to write JSON for " + char);}
8890
}
8991
sys.io.File.saveContent(jsonPath, haxe.Json.stringify(jsonData, null, '\t'));
9092
trace('Remembering this type for future use: ' + jsonPath);

0 commit comments

Comments
 (0)