lime icon indicating copy to clipboard operation
lime copied to clipboard

Add support for include.hxp.

Open player-03 opened this issue 3 years ago • 1 comments

I think I've mentioned before how included projects can't always get the data they need, and it came up again in #1486. It's incredibly easy to get the architectures in an HXP project, but there's just no way in XML, nor is there an elegant way to add support.

There's one issue to be aware of here: all paths in include.hxp will be relative to the main project, which is practically guaranteed to break local paths. So, you have to type out Sys.getCwd() + "local/path" each time. Not a deal-breaker, just something people will have to be aware of.

Oh yeah, I refactored a few things while I was at it. IMO, the whole function should have been named fromDirectory() in the first place, because otherwise it sounds the same as fromFile(). It's a little late to change that now, so I'll settle for making the arguments more explicit.

player-03 avatar Nov 06 '21 19:11 player-03

I've done only basic testing here, but since this is based on the well-tested HXProject.fromFile() function, I don't anticipate major issues. Testing results:

  1. include.xml supersedes include.hxp when both exist.
  2. After removing include.xml, include.hxp can trace messages.
  3. Specifying a relative source path fails; files aren't found.
  4. Specifying an absolute source path succeeds; files are found.

player-03 avatar Nov 06 '21 19:11 player-03