Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Could not figure out exactly what this code does
Message
From
02/06/2009 16:29:36
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01403230
Message ID:
01403275
Views:
117
This message has been marked as a message which has helped to the initial question of the thread.
It's a recursive descent down the directory tree, adding each sub-directory to the path, from the home directory, written in the days when you had to change the default directory to get ADIR to work right.

Hank

>Hi everybody,
>
>I have the following code
>
>LOCAL ARRAY slaDir[1],slaADIR[1,5]
>
>slnDir = 1
>slnNumDir = 1
>DIMENSION slaDir[1]
>slaDir[1] = This.cPjHome
>DO WHILE slnDir <= slnNumDir
>	SET DEFAULT TO (slaDir[slnDir])
>	DIMENSION slaADIR[1,5]
>	slnNumADIR = ADIR(slaADIR,'','D')
>	IF slnNumADIR > 0
>		FOR slnFor = 1 TO slnNumADIR
>			
>			IF LEFT(slaADIR[slnFor,1],1) <> '.'  
>				slnNumDir = slnNumDir+1
>				DIMENSION slaDir[slnNumDir]
>				slaDir[slnNumDir] = slaDir[slnDir]+'\'+ALLTRIM(slaADIR[slnFor,1])
>			ENDIF
>		ENDFOR
>	ENDIF
>	slnDir = slnDir+1
>ENDDO
>
>which I can not really understand 100%. I want to also exclude certain directories, so if I modify this as
>
>LOCAL ARRAY slaDir[1],slaADIR[1,5]
>
>slnDir = 1
>slnNumDir = 1
>DIMENSION slaDir[1]
>slaDir[1] = This.cPjHome
>DO WHILE slnDir <= slnNumDir
>	SET DEFAULT TO (slaDir[slnDir])
>	DIMENSION slaADIR[1,5]
>	slnNumADIR = ADIR(slaADIR,'','D')
>	IF slnNumADIR > 0
>		FOR slnFor = 1 TO slnNumADIR
>		
>			IF LEFT(slaADIR[slnFor,1],1) <> '.'  AND not some extra directory condition checking
>				slnNumDir = slnNumDir+1
>				DIMENSION slaDir[slnNumDir]
>				slaDir[slnNumDir] = slaDir[slnDir]+'\'+ALLTRIM(slaADIR[slnFor,1])
>			ENDIF
>		ENDFOR
>	ENDIF
>	slnDir = slnDir+1
>ENDDO
>
>would the result be the same (except for fewer directories)?
>
>Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform