Change case of library patcher name

Simon O'Rorke's icon

I added a patcher file named sor.printerror.maxpat to the Max 8 Library. Later, I decided on Pascal case (capitalise words concatenated in name) as my personal standard for patcher names. So I renamed the file to sor.PrintError.maxpat :

The case change was not reflected in instances of the object in other patchers. So I deleted all those instances and added them back in again. But the auto-completion list that is shown when adding an object still has the name in lower case. The same is true if I add the object to a patcher that has never previously contained it:

After adding the library object to a patcher, I can manually change the case of the object name in the referencing patcher:

But this is clearly not ideal.

So how can I get the case of the object in the auto-completion list to change to reflect the change of the file name case in the library?
Here's what I have tried and did not work:

  • I deleted the file from the library and added it back in again.

  • I confirmed (by viewing the problematic patcher with a text editor), that there was no reference (such as for a Title property) within the patcher itself to the lower case version of its own name.

  • I renamed the patcher to something completely different and then named it back again.

My guess is that Max has somewhere cached the old name for display in the auto-completion list, retaining the cached name for possible future use even when the patcher was no longer in the library, and has not recognised the subsequent case change as a name change. If that is correct, perhaps there is a way (short of uninstalling and reinstalling Max) of clearing the cache.

Roman Thilenius's icon


it could be that the completion is implemented in lowercase deliberately - cycling also renamed some of the formerly capitalized factory objects to lowercase one day.

have you tried adding those names in question to a max objectmappings.txt file in the package folder?

Simon O'Rorke's icon

Hello Roman

I've created several other library patchers with Pascal case names. As the screenshot of the auto-completion list in my previous post shows, they are not translated to lower case. Only the first one I made is. It's the only one that originally had a lower case name, which I changed when I decided on Pascal case as my standard.

I've not tried using Objectmappings.txt. And I have not been able to find any relevant documentation. What exactly should I put in it?

Thanks,
Simon

Roman Thilenius's icon


it is a textfile which you can put into /packages/mypackage/init/mypackage-objectmappings.txt, containing lines like that:

max objectfile myobject+ myobjectplus;

they use it to come around this restriction in the so called operating system windows, which is not able to allow arbitrary characters in filenames. ;)

not sure why you see what you see but would be interested to learn about it.

mb try to find any potential differences between the files. location stored in, if you wrote it into the objectlist or not, and so on.

it seems superfluent that max tries to "correct" something against your will, when object names are not case sensitive anway.

Simon O'Rorke's icon

Thanks, Roman. Here's what I've tried.

The packages folder in Windows is "Max 8\Packages" within the user's Documents folder, so in my case "E:\Simon\OneDrive\Documents\Max 8\Packages". Into that folder I saved a text file named objectmappings.txt. As the file is not specific to a particular package, I omitted the " mypackage-" prefix shown in your example. The objectmappings.txt file consists of the following text:

objectfile sor.PrintError sor.PrintError.maxpat

After creating objectmappings.txt, I loaded Max, which I understand should cause the contents of objectmappings.txt to be executed.

Then I opened a new patcher and checked the object selection auto-completion menu. Unfortunately the object name remains in lower case.

So that's not the answer. Or perhaps we are on the right track and it just needs tweaking. It did look like a promising thing to try.

Simon O'Rorke's icon

Sorry, I got the objectmappings.txt syntax wrong. I should have followed your instructions more carefully, Roman! So here's my latest attempt, which includes a couple of additional use cases:

max objectfile sor.PrintError sor.printerror;
max objectfile sor.Abc sor.Def;
max objectfile sor.ghi+ sor.ghiplus;

where the Library folder contains files named sor.Def.maxpat, sor.ghiplus.maxpat and sor.PrintError.maxpat.

None of these lines has any affect on the auto-completion list, even if I first reboot the computer for good measure:

So I clearly do not understand how to make objectmappings.txt do anything. That being the case, objectmappings.txt might still provide a fix for the problem I originally reported.

Simon O'Rorke's icon

Regardless of whether there is a workaround, this looks like a bug, which I have just reported. Here's the bug report I submitted:

System Environment
Max 8, Windows 10.

Summary
Case change in library patcher file name is not reflected in auto-completion drop-down.

Steps to Reproduce

Add to the Max library folder (e.g. "E:\Simon\OneDrive\Documents\Max 8\Library") a patcher with a file name of which all letters are lower case (e.g. "sor.casetest3.maxpat").

Add the new patcher as an abstraction to another patcher.

Unload Max. (Optionally reboot the computer to make sure.)

Change the case of some letters in the library patcher's file name (e.g. "sor.CaseTest3.maxpat").

Load Max.

In another patcher, add a new object, typing as much of its name into the object box that the library patcher name is visible in the auto-complete drop-down.

Expected Result
The case of the letters in the library patcher's file name, as shown in the auto-complete drop-down, reflect the case change, as shown in the operating system's file system.

Actual Result
The letters in the library patcher's file name all remain in lower case.

Roman Thilenius's icon


the syntax in the init files is important - if the filename is required to be in a certain form, no idea. (i just copied the style everyone seems to use.)

would have been too easy if it was just that, but great that you tested it.

Simon O'Rorke's icon

Cycling '74 have confirmed that this is a known bug. And I was able to let them know the following workaround that I worked out.

Steps to implement workaround

1. Unload Max if it is loaded.

2. In case something goes wrong, make a backup copy of Max's Database folder. In Max 8 for Windows, this is "%appdata%\Cycling '74\Max 8\Database". As we are going to delete one of the database files Max uses internally, thus forcing Max to reconstruct the database file from scratch, you may notice other changes to the Max environment. I only noticed one, which I shall deal with at the end.

3. Delete file "c--program files-cycling '74-max 8-max.x64.maxdb" (or one with a similar file name) from the Database folder. (This is not a text file, so there's no simple way to instead edit it to correct the faulty data.)

4. Load Max.

5. Open a new or existing patcher.

6. Attempt to add, as an abstraction, a library patcher whose file name case has been changed . At this stage I found that the autocompletion dropdown did not contain any of my library patchers. So, if that happens,

7. Unload Max (discarding the edit to the patcher).

8. And load Max again.

9. Open a new or existing patcher again.

10. Add, as an abstraction, a library patcher whose file name case has been changed. This time it worked for me. My library patchers were back in the autocompletion dropdown, with the ones whose file name cases had been changed showing the correct case.

11. I only noticed one other change to the Max environment resulting from the deletion of the database file. The next time I attempted to search Max Reference, I got an error message: "Search is unavailable as Max is currently rebuilding its database." It was clearly going to take more than a couple of minutes for the search facility to become available again. So I left Max running to fix it. When I checked again in an hour and a half, it was working fine.

Roman Thilenius's icon
Simon O'Rorke's icon

Actually, the message I got is slightly different, more descriptive of what is going on:

So my guesses are that you got your error message in a somewhat different situation and/or you were running a different version of Max.

Roman Thilenius's icon


no, that was from google.