Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getfile()
Message
From
24/04/2019 16:29:37
 
 
To
24/04/2019 15:59:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01668266
Message ID:
01668267
Views:
60
>Hi,
>Is there a way to make getfile() start looking in a by me instantiated directory instead of the default directory?
>Regards,
>Koen

Something like this (untested):
lcFile = my_getfile("c:\default\dir\")

FUNCTION my_getfile
LPARAMETERS tcDefaultDir
LOCAL llError, lcSaveDir, lcFile

    lcSaveDir = FULLPATH(CURDIR())
    IF TYPE("tcDefaultDir") = "C" AND DIRECTORY(tcDefaultDir)
        TRY
            CD (tcDefaultDir)
            llError = .f.
        CATCH
            llError = .t.
        ENDTRY
        IF llError
            MESSAGEBOX("The specified folder does not exist:" + CHR(13) + tcDefaultDir, 0, "GetFile() Error")
            RETURN
        ENDIF
    ENDIF

    * Do the getfile() here
    lcFile = GETFILE(...)

    * Restore original folder
    CD (lcSaveDir)

    * Pass-thru
    RETURN lcFile
Previous
Reply
Map
View

Click here to load this message in the networking platform