>>>>>Dunno - skipping the normal files ?
>>>>
>>>>So, what outweighs? Longer loop or a danger of switching path?
>>>
>>>You don't need to switch paths at all. As Hank said, it was a limitation on aDir() two geological eras ago; nowadays you just give it a full path as a filespec. So
>>>
>>>
procedure recurseDir(tcDir)
>>>local i, n, laDirs[1]
>>>n=adir(laDirs, forcepath("*.*", tcdir, "D"))
>>>for i=1 to n
>>> lcDir=forcepath(laDirs[i,1], tcdir)
>>> if ladirs[i,5]="D"
>>>* this is it, do with it what we need and recurse into it:
>>> RecurseDir(lcDir)
>>> else
>>>* it's not, do something else or nothing at all
>>> endif
>>>endfor
>>
>>You missed the point, Dragan.
>>
>>If you're in the directory and run
>>
>>n = adir(laDir, "",'D")
>>
>>you don't get files listed in your array. Hence was my question.
>
>This was about switching directories - note that there's no Set Default anywhere in this code. You can use aDir() to recurse wherever you want, without moving. The resulting array contains no paths, but the 2nd parameter can contain a path, and it will be respected. But you get files too and need to skip them. BTW, if ladirs[i,5]="D" is wrong, it should be if "D" $ ladirs[i,5].
>
>So just to see what you're talking about, I've tried all of these:
>
>adir(a, "fullpath\", "D") - gives just . and ..
>adir(a, "fullpath", "D") - gives just fullpath
>adir(a, "fullpath\*.", "D") - gives anything that has no extension, file or not
>adir(a, "fullpath\*.*", "D") - gives all directories and files
>adir(a, "", "D") gives subdirectories in current directory (with extension or not)
>
>My preference is to filter out the directories and never change current directory. If there's anything in your code that errors out for any reason, you can't be sure that your cleanup code will Set Default To (lcWhereWeStartedFrom). Your app may not find its pieces if set("path") wasn't recomposed to contain absolute paths. Files you may create after that may end anywhere or nowhere. While fixing this, you may create a prg with the same name as one in another directory and next time you will have the pleasure of fixing one while the other actually runs, etc etc. Which is why I prefer my app to live a sedentary life, no travel.
Personally, I would not even dig into this if we would not run into this strange problem. I wanted to fix it quickly yesterday but instead spent half of the day trying to figure out a way to not touch the code.
I see that I'm even into a bigger mess now with the other problem. If you're VPM long time user, is there a way to not use DD at all for structural changes and let the forms to skip all the validation logic? Of course, I can simply overwrite the Valid logic, but is there a simpler way - using some form's property, for example?
If it's not broken, fix it until it is.
My Blog