Closed augustl closed 4 years ago
I just thought of an alternative approach.
The file iteration can convert all paths on the class path to URL-like relative paths, before sending it through the asset loader. So, it would convert /home/foo/myapp/resources/js/test.js
AND C:\Users\Foo\myapp\resources\js\test.js
to /js/test.js
- and then send it to the matching process.
This means we can leave out the change to a vector representing a glob, and keep using regexps as the default.
Thoughts?
Wow, well done on this! 👏
The second approach seems better to me. Normalizing paths as close to the problem as possible might also stop other bugs from popping up.
We could still support globbing, tho. The regexen are kinda weird.
I agree - didn't think about that until I went to bed right after making this pull request. Should have used mytomatoes.com... :)
I'll make two new pull requests: one for adding support for globs based on java.nio paths, and another for converting file system paths into URLs at the earliest stage possible, requiring the smallest amount of changes.
Note: this pull request depends on https://github.com/magnars/optimus/pull/66. The tests are running fine on travis/unix, but not on Windows, as it stands now.
I'll rebase the pull request against the JSR223 PR once it's ready. For now, this PR exists for quiet contemplation and discussion :)