Have you tried [file which] ?


Le ven. 7 janv. 2022 à 17:58, Roman Haefeli <reduzent@gmail.com> a écrit :
On Fri, 2022-01-07 at 17:34 +0100, Roman Haefeli wrote:
> Dear list
>
> When using a relative path with the new [file], it is resolved
> relative
> to Pd's start location and not relative to the patch.

I'd like to work-around this with [dir(-[pdcontrol] which returns the
directory of the patch which can be used to construct an absolute path
with a given relative path.
However, the hard part is to reliably detect whether a given path is
relative. I thought I could check for absolute paths by checking if the
first byte is a '/' OR the second byte is a ':'. However, it turns out
'C:' is a perfectly valid name for a directory on ext4, for instance.
Doing that detection reliably turns out to be quite hard and probably
involves detecting the OS.

Or am I overlooking a simpler vanilla way?
Roman
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list