[PD] Cross platform path for externals ?

David Medine via Pd-list pd-list at lists.iem.at
Sun Jun 29 17:46:09 CEST 2014

Hey, Jaime!
It also occurs to me that there must be some easy C way to return the 
current path. cd does it, why can't you? A crude solution might be to 
put some platform specific #ifdef statements into the code, but that may 
not get to the heart of your problem.

On 06/29/2014 08:18 AM, Charles Z Henry via Pd-list wrote:
> 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).
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list