[PD] external returning its own path

Martin Peach martin.peach at sympatico.ca
Tue Sep 11 22:54:14 CEST 2012


On 2012-09-11 12:56, Joel Matthys wrote:
> Hi all. I'm working on a Pd external which encapsulates the audio
> language RTcmix, based on Brad Garton's [rtcmix~] Max object. The
> language and its audio functions are in a dylib in the external's
> directory.
>
> My problem is that the external needs to know its own path in order to
> correctly find and reference the dylib. Max has nameinpath() and
> path_topathname() which help with this. Pd's open_via_path() won't work
> here because the path is the unknown.
>
> Does anyone have a suggestion about how to access the external's path
> dynamically?
>

If you have a t_class *c as returned by class_new() then you can do:
char *path = c->c_externdir->s_name;

You might have to
#include "m_imp.h" // for struct _class

Martin



More information about the Pd-list mailing list