Abstractions in subfolders

Geoff Martin's icon

Hi,

I'd like to have a patcher that uses abstractions that live in a subfolder that is in the same folder as the main patcher (see below for a potentially clearer explanation...). It doesn't seem to me to be possible without adding the subfolder to my Max file preferences, which is not an option for me... (I want to distribute the whole package to others, most of whom are using Max/MSP Runtime...)

Is this possible? If not, could this be a feature in a future release of Max/MSP? Please!?

MainFolder

.. MainPatcher.maxpat

.. Subfolder_for_abstractions
... Abstraction1.maxpat
... Abstraction2.maxpat

.. Subfolder_for_graphics
... GraphicFile1.jpg
... GraphicFile2.jpg

Thanks
-geoff

Roman Thilenius's icon

the main difference between search path and not search
path is that you do not need the path to the file when it
is somewhere in the search path.

when you build a project with files located at maxmsp/
myproject/fancysubfolder/ugly.jpg, and later you
distribute the project for use with the runtime, it is
okay to have ugly.jpg in runtime/uglypictures - it will be
found.

-110

jvkr's icon

With the filepath object it is possible to temporarily add folders to the search path. The thispatcher object reports the current location of the patch. These two things combined would be enough to allow the construction of an autolauncher that searches subfolders.

_
johan

1734.autolaunch.zip
zip
Zachary Seldess's icon

Hi Geoff,

And take a look at this.

best,
Zachary

Max Patch
Copy patch and select New From Clipboard in Max.

Geoff Martin's icon

Thanks very much for your help everyone!

The filepath + thispatcher make a great workaround! Still seems odd to me that it's necessary, though...

Cheers
-geoff

JATom's icon

hello cycling team,

this is an ver important unsolved issue since years !

it would be really nice to have a kind of mechanism
where we could set a search path before a path is loaded.
(relative to the loaded path)

or

define a foldername something like "subPatches" which will be automaticaly
added with all subfolders to the searchpath only for the actual opened patch.

we have this already with the path of the patch we opened.

but one level is not enough for normal sized projects.
it an absolute mess putting all patches, javascripts shaders etc.
beside our main patcher.

most of us are placing our projects in the max5 "patches" folder
which is also not optimal, because the every patch is globaly availible
for all projects.

if we have more than one project, we get into trouble.
or defining unique patcher names, which contains the project name.
also a bit awkward ....

so please cycling team give us a possibility to load subpatches
in subfolders without a preloader patch. (like autolaunch.zip )

then we could place a project wherever we want on our harddisk
open it and all relative content will load.
it would be also very, very helpful, if we are working in a team.

that would make live with max/msp much more easier and
many people would have more fun working with max :-)

jaTom

Geoff Martin's icon

Hi,

Seems I'm not out of the woods yet... The filepath + thispatcher solution doesn't work the first time I load the patcher after booting Max. It seems that Max decides that it can't find the abstractions in the subfolder *before* it adds the paths. It works fine if I open the patcher, close the patcher and open it again... but that's not very slick... Sigh...

So, now I have two questions:
- is it possible to force Max to add the paths before it goes looking for the abstractions?
OR
- is it possible for a Max patcher to open a patcher? That way, I could run a patcher to do the addpath first, then open up a second patcher (my "real" one...) and close the first one....

Cheers
-geoff

jvkr's icon

Adding the path to be searched requires a loadbang, which does not happen before all objects are loaded (presumably). And then it's too late. This problem is avoided by using a launcher that opens another patch and kills itself after the patch has been loaded successfully, as showed in the example I included. So 'yes' would be the answer to your second question.

_
johan

Geoff Martin's icon

Johan,

My apologies for not looking at your original solution more carefully...

Thanks for your help!

Cheers
-geoff

Rodrigo's icon

So basically the choices are:

Messy patch with all files in the same directory.
Having patch inside the Max folder (not great for sharing).
Having to load the patch twice (for dependencies to show up).
Having a quick pop-up style window that then loads the patch.

Is that correct?

Definitely not ideal.

I took a look at projects, but that doesn't seem to be a good solution either. It didn't copy over all my dependencies, and the whole 'not saving' thing weirds me out.

lee wang's icon

you can use projects.
select the "project inspector" in the "manage project" menue.
deselect "keep project folder organized"

all this project options are nearly undocumented.
there are no examples ...

and there are still many bugs.

hopefully it will work better in future versions of max.
best,
l.

Rodrigo's icon

Yeah that's what I gathered (undocumented/buggy) about projects. Not exactly an exciting thing to try to commit to, particularly when you share your patches with people (adds another layer of troubleshooting complication).

Roman Thilenius's icon

rodrigo, why same directory? make as many subfolders and you need.

Rodrigo's icon

I haven't even made one (due to the above noted problems). It's all just sitting there, all unpleasant like.

I'd love to have a different folder for each data type.

Roman Thilenius's icon

yeah sure, but why dont you want it to be in the search path?

Rodrigo's icon

I do. Or do you mean why not have the whole patch IN the max folder?

I don't keep or manage my own patches in there, and also for distributing, it adds another complication (patch must live IN the max folder).

It's much easier for it to just work, wherever it is on their computer (or mine for that matter).

Roman Thilenius's icon

well ok i see, for distributing the patch without runtime it would of course be nice if a quasi relative path to the main patcher would make it to open its stuff right after unzipping some users download.

but i think that it will also work to tell people to move your project folder into their max runtime folder by hand before starting it. users who have max will know that by heart, and users who dont have max will eventually need to download and install max runtime app anyway.

compared to the installation of a plug-in for photoshop or cubase this isnt not more than the usual work for the user - or for the developer, because you can of course just put your project folder into an apple or alladdin installer package and make it prompt the user with a "where is your max runtime folder" and put an alias of the main patcher onto the desktop.

another alternative, but some people will hate that, would be to make an installer which moves everything in a standard path of the OS (:user:application support: or :preferences: or something like that), then you can use
those parts on your system while developing.

-110

Rodrigo's icon

Yeah that is possible but then if they don't put it there and open it, it spits out a ton of errors. I'd sooner just have a messy folder, but be able to keep it anywhere. (I keep all my max stuff/patches in my Dropbox folder for example).

Rodrigo's icon

It would be a total non issue if Max looked into the folders of wherever the main patch was, rather than just the root level.

Peter Castine's icon

This has been a feature request going back for well over a decade.

The reason given for *not* implementing this, many years ago, was that a patcher could be at the top level of the desktop and (on Classic Mac OS) adding all subfolders in this situation would mean searching the entire directory hierarchy of every mounted drive.

This is, however, not the case on Mac OS X nor (I believe) on Windows, where the Desktop is simply a special folder inside the user's home folder.

I am not aware of any other really compelling reasons for not automatically adding subfolders to the working search path (but will stand corrected if someone can present one).

Rodrigo's icon

Yeah it seems like it would just be a simple line of code to tweak. Perhaps in the preferences it can limit the depth of search (defaulting at like 2 or something, so if you do have it at root level, it doesn't go crazy deep).

It's preposterous that there isn't a simple way to tidy patches up for sharing.

Roman Thilenius's icon

there are many other places, aside from the desktop, where a patch could be when you click it and causing max to index the system folder or a complete harddrive, or at least the safari downloads folder, where there is already another - the wrong one - "audioplayer.maxpat" side by side.

temporarily including a path outside the search path to the search path seems to remain bullshit, however you try to implement it.

btw, another solution would be to ignore cyclings christmas wishes about EULA and copy rhabarber, and inlcude a max runtime with your shared patches.
if you also include a weblink to cycling.com i dont think they will hunt you down for doing so.

btw2, i know a guy called 110 who once needed 9 moths to find out that there is something like "search path" in programming languages and how to work with them, so be happy that you at least know what it is.

-110

tschoepler's icon

@jvkr: thanks, works like a charm.