[PD] Cross platform path for externals ?

Charles Z Henry via Pd-list pd-list at lists.iem.at
Sun Jun 29 17:18:04 CEST 2014


On Fri, Jun 27, 2014 at 8:57 PM, Jaime E Oliver via Pd-list
<pd-list at lists.iem.at> wrote:
> Hi Everyone,
>
> I'm trying to get my head around this problem, and I am not sure the subject describes it well…:
>
> In an external, I'm writing into a file with:
>
> FILE *fp1;
> fp1 = fopen(x->globalpath, "w");
>
> I provide the external with x->globalpath through a message such as "open /home/user/filename.txt", but I am trying to find a path that would work on both os x and linux, so that it at least works in two platforms and my help file isn't platform specific.
>
> In Linux, I call Pd from the console with "pd" and I send several relative paths like "filename.txt" , "~/filename.txt", or "./filename.txt" work.
>
> In OS X, If I call Pd from the Terminal, I can also use these relative paths. By relative i mean relative to the Pd executable (bin).
>
> However, in OS X, when I double click on the Pd Icon, these same paths are not valid. I am trying to figure how textfile's write message does it, but I cannot locate the point in source where this is done.
>
> Anybody has any pointers?
>
> best,
>
> J

What comes to mind is that you could write some "post()" calls in your
external to print out x->globalpath to the console when the setup
routine is called.  Then, try it out on different platforms and with
different launch methods (terminal vs menu item).

Aside from just trying it out, you need some insight into the code
(the reason for your mail of course).



More information about the Pd-list mailing list