[PD] create folder implementation
Matteo Sisti Sette
matteosistisette at gmail.com
Thu Jan 14 18:52:15 CET 2010
colet.patrice at free.fr escribió:
> Selon Matteo Sisti Sette <matteosistisette at gmail.com>:
>
>> Any suggestions on how to check for the existence of a directory?
>>
>
> it would be childish if [sys_gui] or another object would retrieve tcl console
> output, then [puts [glob -type d My-Dir]< would do the trick, or just a bang
> when tcl command is done.
>
I tried the attached patch without success.
I know it's not an example of best practice, but I expected it to work.
the strategy consists of 3-steps in a single trigger:
[t a a a]
1 2 3
1) send the [file mkdir...( message with [sys_gui]
2) keep pd busy in an [until] loop which, at each iteration, checks
whether the folder exists and, if so, exits the [until] loop.
I do this with [folder_list], reading the list of files contained in the
directory where the new subdirectory is to be created and checking
whether one of the symbols it outputs matches the complete path name of
the to-be-created directory
3) I create the file with [textfile]
This doesn't work. I've put a maximum of 1000 iterations to avoid
hanging pd forever. However, even if I change it to 10000, 100000 or
even infinite (a bang), it never works.
Note that the [until] loop thingie does work if isolated and used to
check the existence of a directory.
It seems like the actual creation of the directory (possibly even the
act of sending the message to the gui process??) is "deferred" untill
the completion of the whole message-tree. Is that so?
--
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_blocking_create_dir - copia.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100114/541b8ffc/attachment.txt>
More information about the Pd-list
mailing list