[PD] R: Re: saving relative paths in a textfile

Athos Bacchiocchi athos.bacchiocchi at tin.it
Wed Feb 2 12:42:55 CET 2011


>----Messaggio originale----
>Da: matju at artengine.ca
>[gf/find_file] 
searches the pd path (list of -path options or equivalent 
>menu in the 
settings). 
[cut]
>If you don't want to have to type the name of the 
patch, you can use 
>[gf/canvas_filename] to find it :
[cut]
>But note 
that if the pd patch was open with a location relative to the 
>CWD, 
then [gf/find_file] may output a relative name, as in the screenshot. 

[cut]
>and in such cases, the reported location will be incomplete, 
though it can 
>be completed using [gf/getcwd]

thank you mathieu,

If 
i didn't misunderstood, your hint is to get the patch's path and 
compare it with the sound file's path given by openpanel, to obtain a 
relative path.

So, as an example, if the patch containing the arrays 
stays in:

/home/athos/pd/mypatch

And the sound files are in


/home/athos/pd/samples

Openpanel will output:


/home/athos/pd/samples/sound.wav

Using the gridflow objects:

[bang(
|

[gf/canvas_filename 0]
|
[gf/find_file 0]

I get: 


/home/athos/pd/mypatch/mypatch.pd

(using [getdir] i can directly 
obtain: /home/athos/pd/mypatch)

And i will try to get:

..
/samples/sound.wav

I guess starting with [s2l] and some list comparing 
objects.

Am I on the right "path"? :)

athos

PS: i tried opening the 
patch doing
cd /home/athos/pd/mypatch
pdextended mypatch.pd
and i still 
get an absolute path from [gf/find_file 0]




                                                                                                                                                       



More information about the Pd-list mailing list