Hi Petr,

Try the release 2.2 when available. That should work better for you. Your 
program seemed to work find searching my 12Gig drive....

  - jim


At 12:59 PM 11/2/99 +0100, you wrote:
>Hi,
>
>I know it was discussed several times already here, but I would like
>someone to clear things a little bit for me here:
>
>I tried to write a function, which looks for some file, on a path given.
>I use recursion, but Rebol is not able to scan my root directory,
>something has to overflow somewhere in memory, and I anticipate I am
>doing something wrong.
>
>The calling convention is as follows:
>
>->> find-on-path %/D/ %Netscape.exe    ; will look for the file on the
>path given ....
>->> find-on-path/subdirs %/D/ %Netscape.exe ; will scan all
>subdirectories too
>
>
>find-on-path: func [{Find file on given path ... (end dir entries with
>"/")}
>                      path
>                      file
>                      /subdirs
>                        "Scan also subdirectories ...."
>                      /local dir-list reduced-dir-list
>                   ][
>
>print ["Scanning: " path]
>
>      dir-list: copy []
>      dir-list: load path
>
>      either found? find dir-list file [
>              print [file "nalezen na ceste: " path]
>              return path
>      ][
>
>        either not subdirs [return none][
>
>            reduced-dir-list: copy []  ; let's reduce dir-list to contain
>directories only ...
>
>            foreach dir-or-file dir-list [if dir? join path dir-or-file
>[insert reduced-dir-list dir-or-file]]
>             dir-list: copy reduced-dir-list
>             reduced-dir-list: copy []
>
>            foreach dir dir-list [
>              result: find-on-path/subdirs join path dir file
>                if not none? result [return result]
>            ] return none         ; I tried also unset 'dir-list in front
>of return none here ....
>
>      ]
>
>     ]
>
>]
>
>
>I tried mereyl everything - I am clearing block, initialising them with
>copy [], setting them as local variables, unsetting blocks, etc. I don't
>know, where it is overflowing, as dir structure is not so much nested. I
>remember some discussion on 'foreach making copy of series given? Uh,
>could anyone help, please?
>
>Also, is there any chance to have only directories in the resulted block
>after loading a path?
>
>What does happen in the memory during the recursive call? Is body of
>function in memory just once, reserving just separate space for each
>local var, or?
>
>Thanks,
>
>-pekr-

Reply via email to