Closed dmitmel closed 3 years ago
The PR description could need some newlines.
Which is, of course, a violation of the "specification" (imagine me making the harold face while writing this sentence).
If you read this "specification" :unamused: more carefully, then you would have probably also seen that the assets/
directory is actually configurable via the assetsDir
option in ccmod.json
, something CCLoader2 never implemented, and is thus another difference between v2 and v3 (other than the baseDirectory
kerfuffle).
Of course, it would be hard to notice this without an actual documentation, something that, in general, is best written by the person that actually wrote the code. :wink:
This change will break bobrank (as published in ccmoddb) when run in a browser, but I don't really care :woman_shrugging:
For context:
This PR has to do with handling of the
assets
field in mod manifests (bothccmod.json
andpackage.json
). For a long time (beforeccmod.json
, so only inpackage.json
) it was assumed that the paths listed in this field are relative to the mod's root directory not to the mod's assets directory, so much so that this is how it had been implemented in CCLoader, and that we discussed this point when designingccmod.json
, and that I considered this while implementing CCLoader3 (spoiler: its implementation ofpackage.json
not affected by this PR). We have decided to improve this situation inccmod.json
by making the asset paths relative to the assets directory. However, sinceccmod.json
support was implemented in CCLoader2, I and (to my knowledge) @L-Sherry have discovered that it continues to treat asset paths inccmod.json
as relative to the root directory, thus making browser support tricky. This is due to the fact that the same function (_findAssets
) was being used for collecting assets from mods with bothccmod.json
andpackage.json
. Which is, of course, a violation of the "specification" (imagine me making the harold face while writing this sentence). HOWEVER, apparently this field has been broken altogether ever since babe5f819bbbfc674d0885ff07f024a193d4a945, and that commit was made almost a year ago at this point. As such we have decided to fix path relativeness by making them relative to the assets directory in BOTH manifest formats, since inpackage.json
it wasn't working in the first place for a while now.