From 76437a30141f1f384fdef2d2159b01a7aa2d2d97 Mon Sep 17 00:00:00 2001 From: player-03 Date: Sun, 11 Feb 2024 21:18:19 -0500 Subject: [PATCH] Don't set `asset.id` to an empty string. The `Asset` constructor sets `asset.id` to the asset's path, a sensible default. Of course, if the asset has a name instead of a path, we have to use that instead. Or if the user specified an ID, that's even better. We just don't want to default to `""`, since then a bunch of assets could have the same ID. Resolves #1758. --- src/lime/tools/ProjectXMLParser.hx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lime/tools/ProjectXMLParser.hx b/src/lime/tools/ProjectXMLParser.hx index 6f6bc7dc1..784f91bfc 100644 --- a/src/lime/tools/ProjectXMLParser.hx +++ b/src/lime/tools/ProjectXMLParser.hx @@ -676,21 +676,18 @@ class ProjectXMLParser extends HXProject } } - var id = ""; - + var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed); + asset.library = childLibrary; + if (childElement.has.id) { - id = substitute(childElement.att.id); + asset.id = substitute(childElement.att.id); } else if (childElement.has.name) { - id = substitute(childElement.att.name); + asset.id = substitute(childElement.att.name); } - var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed); - asset.library = childLibrary; - asset.id = id; - if (childGlyphs != null) { asset.glyphs = childGlyphs;