If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, July 20, 2016 4:34 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Actually I discovered that my code was disappearing after the commands were executed so I did some more Googling and found that the value to be saved is returned by CURDIR() rather than SET('DEFAULT'). It gets restored with "SET DEFAULT TO." That explains why things weren't working for me! Somehow it seems better terminology could have been chosen!
Thanks,
Joe
On Wed, Jul 20, 2016 at 3:57 PM, rafael copquin rafael.copquin@gmail.com wrote:
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe