Bizarre "No such object" behavior

Oct 18, 2007 at 7:10am

Bizarre "No such object" behavior

On the max file path:
Create a patch called “whatever.pat”
Create a js file called “whatever.js”

Open a new patch and create the object “whatever”
error: whatever: No such object

Rename the file “whatever.pat” to “whatever”
Now it works! Why doesn’t it work with .pat?

I recently renamed a few patches to use the .pat extension and suddenly Max couldn’t find them anymore. That was confusing! I suppose the lesson is to not use the same name for patches and js files. Should have known better…

-Adam

#34227
Oct 25, 2007 at 10:32am

Quote: adamj wrote on Thu, 18 October 2007 09:10
—————————————————-
> On the max file path:
> Create a patch called “whatever.pat”
> Create a js file called “whatever.js”
>
> Open a new patch and create the object “whatever”
> error: whatever: No such object
>
> Rename the file “whatever.pat” to “whatever”
> Now it works! Why doesn’t it work with .pat?
—————————————————-

There are two possible issues: (1) the order Max searches files in a directory and (2) the .pat suffix conflict with PhotoShop.

In reverse order: if you have PhotoShop installed, it also dibs the .pat suffix and the Finder, PhotoShop, Max, and everyone else gets confused about what sort of document the file is supposed to be. For that reason alone I would avoid .pat and, if you must tack on a file-type suffix, use .mxb (which only conflicts with something incredibly exotic that probably no one has).

Otherwise, at least on Mac OS, Max seems to walk through the files inside a directory in alphabetical order. As an exercise for the reader, put “whatever”, “whatever.js”, and “whatever.pat” into alphabetical order (hint: most of the work has already been done for you). If Max encounters “whatever.js” first, opens it (it’s a text file, right?) tries to parse it and discovers it doesn’t start with all-important ‘max v2;’ statement, well, it punts the entire filename matching operation for “whatever”.

That should explain everything, I think.

#115134
Oct 25, 2007 at 4:44pm

Quote: Peter Castine wrote on Thu, 25 October 2007 03:32
—————————————————-
>
> There are two possible issues: (1) the order Max searches files in a directory and (2) the .pat suffix conflict with PhotoShop.
>

I don’t have PhotoShop installed so it’s probably (1).

> Max seems to walk through the files inside a directory in alphabetical order. As an exercise for the reader, put “whatever”, “whatever.js”, and “whatever.pat” into alphabetical order … If Max encounters “whatever.js” first, opens it (it’s a text file, right?) tries to parse it and discovers it doesn’t start with all-important ‘max v2;’ statement, well, it punts the entire filename matching operation for “whatever”.

I think you are spot on with this explanation. Makes complete sense.

I switched to using .pat after I started using version control (Subversion) with my Max stuff. I had been omitting the .pat extension, until I tested what happens when I check out my patches from version control. The file associations were lost in OS X and Finder didn’t recognize they were Max files anymore. Even worse, Max couldn’t open the files – they were grayed out in the file browser. Renaming to .pat was the easiest solution.

So a warning/suggestion to other folks who might be doing similar things:
* Use the .pat extension
* Don’t reuse names between .pat, .js, or other file types.

-Adam

#115135
Oct 26, 2007 at 1:38pm

Yeah, I really wanted to start using Subversion, but the support for Mac OS is simply awful.

I understand that the SVS developers want to keep the core code OS-independent (although their idea of OS-independence is spelled u-n-i-x). But I would have hoped that there would be a front-end by now that would keep all the hoops and whistles necessary for life under Mac OS transparent to the user.

I second your recommendations, although some people may find the .mxb/.mxt endings a useful alternative.

– P.

#115136
Oct 26, 2007 at 5:48pm

Quote: Peter Castine wrote on Fri, 26 October 2007 06:38
—————————————————-
> Yeah, I really wanted to start using Subversion, but the support for Mac OS is simply awful.
>

It’s really not bad if you are developing externals inside an IDE. Eclipse support is passable (I use the subclipse plugin), IntelliJ is much better (but costs money), and for C externals it sounds like Xcode does a pretty good job: http://developer.apple.com/tools/subversionxcode.html (haven’t tried it yet though)

For patches I’ve been using SvnX. It gets the job done.
I’ve also been thinking I could just setup my patches directory as a project in my IDE and use the IDE’s SVN support.

It’s great that Max 5 is going to use JSON as the new file format – doing diffs against an old version of a patch will actually make sense!

-Adam

#115137

You must be logged in to reply to this topic.