OpenBagTwo / EnderChest

syncing and linking for all your Minecraft instances
https://openbagtwo.github.io/EnderChest/
GNU General Public License v3.0
3 stars 2 forks source link

Find out where a particular file links to / from #83

Closed OpenBagTwo closed 1 year ago

OpenBagTwo commented 1 year ago

GIVEN Steve has EnderChest set up on his system, linking multiple instances to multiple shulker boxes AND he wants to find which shulker box is providing a particular resource pack, world save or config file,

WHEN he opens a terminal, navigates to his minecraft root and runs the command:

$ enderchest inventory minecraft some_instance --path resourcepacks/cool_resource_pack.zip

(see notes for variations)

THEN he gets back a message:

instances/some_instance/.minecraft/resourcepacks/cool_resource_pack.zip links to the "pretty resource packs" shulker box

regardless of whether the copy of "cool_resource_pack.zip" inside the "pretty resource packs" shulker box is itself a symlink,

BUT ONLY if the symlink into his instance isn't overwritten by a shulker box with a higher priority

SO that he doesn't have to go digging through the entire list of shulker boxes returned by enderchest inventory shulker_box to find the one providing that file when he wants to delete, replace or modify that file


GIVEN Narrator is wanting to replace a given mod, config or resource pack

AND wants to make sure that the change only propagates to the instances he wants

WHEN he opens a terminal, navigates to his minecraft root and runs the command:

$ enderchest inventory shulker_box dev_box --path mods/best_mod_ever.jar

(see notes for variations)

THEN he gets back a message:

EnderChest/dev_box/mods/best_mod_ever.jar is linked to by the following instances:
- 1.20_dev
- testbench
- important_smp

where the list of instances only includes the instances where the symlink isn't overwritten by links to other higher priority boxes

SO that he knows whether he can safely replace the file in that box or whether he should do it in a box with higher (or lower) priority

Notes

This isn't quite as simple as reading each link's target, mostly because of the abspathing / full-link-resolving that EnderChest does by default.

Supported syntaxes

OpenBagTwo commented 1 year ago

Implementation idea:

  1. Running place creates a dictionary of links to their targets
  2. This inventory operation then just queries the dictionary

Optional:

  1. Running place caches the dictionary in a hidden file (set to not be synced) in the EnderChest root
  2. Then inventory just queries the cache

This would be less for performance reasons as to enable inventory to give the information on the last place (to meet the use case of "I just updated my mods through PrismLauncher, and that deleted a bunch of symlinks, and now I'm trying to figure out where to put the new mod files"

Bonus: --path should support glob-style wildcards