Forums > MaxMSP

Relative paths or thispatcher inside an abstraction

January 7, 2009 | 5:47 pm

Hi all,

I’ve searched on the archives for this but I’m really trying to make the issue of relative paths simpler for myself.

I have a very simple patch to get the absolute path of my main patch and then append sub-folders to it to open files. So far nothing exiting, there are plenty of examples to do this on the forum. My first problem with previous posted solutions is that there are several objects involved in doing this and I’m constantly loading external files from all over my patch. So I would have to move (or copy around) a group of objects just to feed files to my objects that need it. My ideal solution of course would be to just use the "message" object and simply write "open /mysubfolder/myfile.myext". Since that is not possible my current solution is to have the following:

message object—"open subfolder/subfolder/myfile.myext
|
|
sfolder———- My patch that deals with the details
|
|
My object that needs a file from a subfolder.

This works to a certain extent, but If I try to use "sfolder" as an abstraction it breaks, as the "thispatcher" object will report the absolute path of the original patch (somewhere in the C74 folder) and not the path of the patch that is loading the abstraction. Also if I try to put the contents of "sfolder" in a sub-patch the "thispatcher" objects seems to get lost and reports "/" as it’s location.
Is it possible to use "thispatcher" inside of an abstraction the way I am trying to do?

At the moment what I have to do is manually copy the "sfolder" patch to the root folder of every project next to the main patch. Should I call it a day and just keep doing it that way?

The patches need to be saved to the same folder, in this case it is looking for a file called "01.wav" on a subfolder called "snd"

Thanks in advance

-Miguel

Sfolder:

– Pasted Max Patch, click to expand. –

Main patch

– Pasted Max Patch, click to expand. –

January 7, 2009 | 6:59 pm

thispatcher has to live in the main patch, not an abstraction. i guess you’ve figured that out.

my solution is to have at load time, thispatcher spit it’s path to a send object. the abstractions have the receive object which concats the path with their local paths.


January 8, 2009 | 6:16 am

it seems that [rtcmix~]‘s help file handles this subfolder file issue pretty well.


January 13, 2009 | 11:21 pm

Hi Rob,

I was afraid that there would be no way to use [thispatcher] on the way I wante. Well I guess I’ll just have to deal with it.

@mesa

I don’t have [rtcmix~] on my machine but I would imagine that the help file would be inside max’s search path. Is this the case?
or is there any particular relative-folder wizardry in the patch?

-Miguel


January 14, 2009 | 12:49 am

On Jan 13, 2009, at 6:21 PM, Miguel Ortiz wrote:

> I don’t have [rtcmix~] on my machine but I would imagine that the
> help file would be inside max’s search path. Is this the case?
> or is there any particular relative-folder wizardry in the patch?

I use the [thispatcher] at the top-level and use that as a base for
where any sub-folders live, then send that out to various [sprintf]
objects that properly construct the pathname. Then they send a [set]
message to message boxes to capture the relevant info. Then I bang
the message boxes when I need the path/file/whatever.

Don’t download any of my stuff until tomorrow, though. :-)

brad

http://music.columbia.edu/~brad


Viewing 5 posts - 1 through 5 (of 5 total)