Skip to content
This repository has been archived by the owner on Oct 14, 2019. It is now read-only.

Added optional runtime path for buildController macro. #140

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

tiagolr
Copy link
Contributor

@tiagolr tiagolr commented Aug 17, 2014

Because in openfl its usual to rename the assets paths, my app was freezing when using @:buildMacro("assets/xml/ui/MyPopup.xml")

now it works if i add the runtime (renamed) path as second argument:

@:buildMacro("assets/xml/MyPopup.xml", "ui/Popup.xml")

@ianharrigan
Copy link
Owner

Im not really sure why you would do this... Why wouldnt you just use the path that is correct?

@tiagolr
Copy link
Contributor Author

tiagolr commented Aug 18, 2014

Cause openfl renames the path, i have:

<assets path="assets/xml/ui" rename="ui" />

If i use the renamed path, the macro won't find the file, if i use the original path, the runtime will crash when doing : super("assets/xml/ui") inside constructor.

Meanwhile i started extending Popup class instead so i no longer use this method, this is used by a very particular case: Using BuildComponent macro where openfl renames the assets path.

@ianharrigan
Copy link
Owner

Hmmm... right, i see... there must be a better way of doing this... I dont like having to alias it... You maybe right and its the only way, but ill investigate if there is another way to resolve the .xml file at build time... I mean im guessing all the <asset /> entries must be available somehow? Ill have a think about it. If i cant get that info then it will have to be this method, but initially im not that keep on the second parameter.

Cheers,
Ian

@tiagolr
Copy link
Contributor Author

tiagolr commented Aug 19, 2014

Cool, I'm fine with that since i don't need it atm, its a very specific case but may happen again with someone in the future, there may be alternatives but i don't see an easy one:

  • embedding the xml file on the constructor, the drawback with this one is that live reloading won't be possible if someone needs it.
  • looking at compile arguments for renamed paths (don't know how this can be done)
  • looking for the same asset on a different folder (a lot of work, checking all files etc... forget it :p)

@tiagolr
Copy link
Contributor Author

tiagolr commented Aug 27, 2014

Added a new commit, feel free to discard any additions, this last one to Popup its pretty useful to quickly customize / have more control over popup buttons.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants