Hello,

Would it be possible that suubsquent calls to mountFixedDir with the same exacts parameters, instead of creating a new directory, increase an internal reference counter, which would be decreased by unmount and detach?

Let me explain.
Most of the time when writing peripheral, we may need to add a new api to "rom/apis" in the form
computer.mountFixedDir("rom/apis/foobar", "mods/foobar/foobar.lua", false, 0)
The issue is that if you have 5 peripherals around, you get rom/apis/foobar, foobar2, etc… and when removing the first peripheral who tried to mount, you lose rom/apis/foobar
Right now the only way to deal with it is to store the list of devices for a given computer and when a device is disconnected, ask another one to mount the directory.

So here is how it could work when a computer is plugged with 3 similar devices:
  1. Device 1 attach: call mountFixedDir on rom/apis/foobar with mods/foobar.lua as a source, create a counter with ref count set to 1
  2. Device 2 attach: makes the same call with the same parameters, ref count increase to 2
  3. Device 3 attach: makes a slightly different call (like read only has changed or the source is not the same), that creates rom/apis/foobar2 with ref count set to 1
  4. Device 1 detach: we decrease the ref count on rom/apis/foobar by one, we still have 1 ref going on
  5. Device 3 detach: ref count on rom/apis/foobar2 drops to 0, unmount
  6. Device 2 detach: ref count on rom/apis/foobar drops to 0, unmount
That would make providing an API a lot less painful that before, as I'm pretty sure that 99.999% of modders don't really want that foobar2 folder, and for cases where 2 different mods try to mount the same folder, the source folder won't be the same, and based on my proposition, won't override the existing one.