[PD] create folder implementation

Jack jack at rybn.org
Thu Jan 14 19:23:54 CET 2010


Maybe not nice, but it should work.
++

Jack



Le jeudi 14 janvier 2010 à 18:52 +0100, Matteo Sisti Sette a écrit :
> 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?
> 
> 
> 
> pièce jointe document texte brut (test_blocking_create_dir - copia.pd)
> #N canvas 681 23 450 711 10;
> #X obj 247 332 sys_gui;
> #X obj 188 99 dirpanel;
> #X obj 192 57 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
> -1;
> #X msg 263 174 symbol \$1/newdir;
> #X obj 33 332 textfile;
> #X msg 40 283 set \, add cis boom bash \, write \$1/newfile.txt;
> #X msg 218 245 file mkdir \$1;
> #X obj 117 560 folder_list;
> #X obj 114 403 until;
> #X obj 137 334 t b a a;
> #X obj 130 479 symbol;
> #X obj 163 145 t a a a a;
> #X msg 58 223 symbol \$1/newdir;
> #X obj 116 589 t a a;
> #X obj 126 505 t a b;
> #X msg 209 635 ====;
> #X obj 14 306 t b a;
> #X obj 265 204 t a a a;
> #X obj 125 619 select -;
> #X msg 105 533 symbol \$1/*;
> #X obj 112 650 t b b;
> #X obj 116 439 t b b;
> #X msg 96 371 1000;
> #X connect 1 0 11 0;
> #X connect 2 0 1 0;
> #X connect 3 0 17 0;
> #X connect 5 0 16 0;
> #X connect 6 0 0 0;
> #X connect 7 0 13 0;
> #X connect 8 0 21 0;
> #X connect 9 0 22 0;
> #X connect 9 1 10 1;
> #X connect 10 0 14 0;
> #X connect 11 0 12 0;
> #X connect 11 1 9 0;
> #X connect 11 3 3 0;
> #X connect 12 0 5 0;
> #X connect 13 0 18 0;
> #X connect 14 0 19 0;
> #X connect 14 1 15 0;
> #X connect 16 1 4 0;
> #X connect 17 0 6 0;
> #X connect 17 2 18 1;
> #X connect 18 0 20 0;
> #X connect 19 0 7 0;
> #X connect 20 0 8 1;
> #X connect 21 0 10 0;
> #X connect 22 0 8 0;
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testCreateDir.pd
Type: text/x-puredata
Size: 1166 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100114/0ea29069/attachment.bin>


More information about the Pd-list mailing list