Set Path, Set("Path")
This command lets you specify a series of directories that FoxPro should search when you ask for a file. Although it serves the same purpose, it's not connected to the DOS search path. Usage | SET PATH TO [ ListOfDirectories ] cCurrentPath = SET( "PATH" ) |
cList = "C:\WINDOWS,SYS(2004)" SET PATH TO (cList)results in a path of:
C:\WINDOWS,SYS(2004)Even using a macro instead of indirect reference has the same result. To get the desired effect, you have to make sure the function is evaluated before you get to the SET PATH line:
cList = "C:\WINDOWS,"+SYS(2004) SET PATH TO (cList)Unless there's only one directory in the list, you can't include the function call right in the SET PATH line. To our utter astonishment, SET PATH can handle directories with embedded spaces without having to surround them with quotes. We had no problem SETting PATH TO C:\Program Files (perhaps our least favorite directory ever). It kind of makes sense, since SET PATH doesn't see a space as a delimiter, but it sure is different than the way VFP handles embedded spaces elsewhere.
Example | SET PATH TO C:\WINDOWS, F:\VFP ? SET("PATH") && Returns "C:\WINDOWS,F:\VFP" * Can use function call for one item SET PATH TO (SYS(2004) + "\DATA") * But the following DOESN'T work as you'd expect SET PATH TO (SYS(2004) + "DATA"), C:\WINDOWS * Do it this way instead cList = (SYS(2004) + "DATA")+", C:\WINDOWS" SET PATH TO (cList) |
See Also | ChDir, FullPath(), Set Default, SYS(3056) |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.