>Hi all,
>
>I have a program where I use the following code to finde the default path of the program:
>
>m.home = SYS(16)&& save executing program file name
>IF !glDebug
> pos = AT(UPPER('\MyProgram.exe'), UPPER(m.home), 1)
>ELSE
> pos = AT(UPPER('\progs\MyProgram.fxp'), UPPER(m.home), 1)
>ENDIF
>m.home = SUBSTR(UPPER(m.home), 1, pos)
>RELEASE pos
>gcPath = m.home
>
>SET DEFAULT TO &gcPath && Line the error occurs at
>
>As long as the program is located in the C:\MyProgram\, no problem. As soon as I move the program to let's say C:\Program files\MyProgram\, I get an "Invalid Path Name" error. If I choose "Ignore", the utility runs properly.
>
>What could be causing this???
>
It's the spaces. The above should work if you change it to SET DEFAULT TO (gcPath).
BTW, as a hint, you can simplify the above in a couple of ways. If you're using VFP 6.0 (or want to use foxtools in a previous version), you can simply use gcPath = JustPath(SYS(16)). Or if you're not using 6.0 and don't want to use foxtools, gcPath = LEFT(SYS(16), RAT('\', SYS(16))). In either case, regardless of whether or not you're debugging the path will be properly returned.
George
Ubi caritas et amor, deus ibi est