4ms/metamodule

Unify use of Patch Name and file name

Opened this issue · 2 comments

Every patch yaml file has a PatchName field, which may be different than the file name. This is confusing because the PatchName is used in the Patch Selector page, but the filename might be changed if you do "Duplicate" or manually copy files on the computer.

I'm not sure I see any value in having both of these -- why would someone need to have them be different?

One solution would be to ignore the PatchName field and just use the file name everywhere. Some of the default patches would have slightly more ugly names, but that's probably the only downside.

Another solution would be to show both the file name and patch name in the patch selector list. One of them could display at the top of the screen as the list is scrolled.

This was addressed in v2.0.6 of the vcv plugin.
When saving a patch, the patch name and file name are the same -- except slashes and colons are removed and . => _ from the file name.

To follow in these lines, we could do the same on hardware: changing the file name changes the patch name and vice-versa. Slashes, colons, and . could be restricted from both patch and file names.

Legacy patches could still exist with different names, so that would need to be handled.

For firmware, we want to keep the Patch Name and File name the same (except for the extension).

If a user changes the filename, the patch name automatically updates (minus the .yml extension). That part should be straightforward since the filename can only be changed in the Duplicate (aka first time Save) pop-up.

Going the other way, if a user changes the patch name from the Patch Description page, then it's not quite so straightforward... The issue I see is that if we change the file name of the open patch, then if/when the user Saves the patch, a new file will be created. The old file will still exist with the old name, and that will be confusing (changing the patch name should not make a copy of the patch).
So we could add a flag to the OpenPatch class that indicates the filename has been changed. When the patch is saved, if this flag is set, then it deletes the old file (if and only if saving was successful).