[PD] Looking for file match without reporting error

Roman Haefeli reduzent at gmail.com
Sat Jan 23 21:20:44 CET 2016


Hey Samuel

On Sat, 2016-01-23 at 17:51 +0000, Samuel Burt wrote:

> I've been using textfile to save and load some preset values in a
> complex collection of related GUI tools. I'd like to be able to start
> with no presets and allow the user to define them separately in
> different project environments or just leave them without setting
> them. My problem is that textfile searches for these preset files
> whether they exist or not and the present the user with errors in the
> log window. Is there a way for Pd to look for the files first and if
> they aren't found not pass on the load file commands to textfile?
> 
> 
> I know I could create default preset text files for all of them, but
> it is useful for a user to copy the whole directory and then empty the
> preset text file folder, which now that I think of it could be a one
> button press.

For similar reasons I was looking for a way to check the existence of a
file without causing an error message. I came up with this:

https://github.com/reduzent/netpd/blob/master/includes/netpd-if-file.pd

It uses [readdir] from moocow and [getdir] from ggee. Though quite
kludgey, it was the only way I was able to achieve that. If someone
knows of a better way (even if it uses an external), please let us know.

Roman 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160123/5047adbf/attachment.sig>


More information about the Pd-list mailing list