colet.patrice@free.fr escribió:
Selon Matteo Sisti Sette matteosistisette@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
send the [file mkdir...( message with [sys_gui]
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
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?