Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine local drive letter?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00259820
Message ID:
00260172
Views:
21
>>>>>>>I am working on a small app that is to reside on a network. When the user runs the app, they select the types of information they need and based on this various tables and other files are to be copied to a directory on the users local drive. How do I determine what the local drive letter is?
>>>>>>
>>>>>>Hi Colin,
>>>>>>
>>>>>>Well, it depends on which version of VFP you're running. In 6.0 DRIVETYPE() was added to the language. Previously, the same function is in Foxtools. You can either loop through and check each drive letter to see if it's a local hard drive, or use an API call (either GetLogicalDrives() or GetLogicalDriveStrings()) to get the valid drive letters.
>>>>>
>>>>>Thanks George. I do have VFP 6. I am looping through A to Z using DRIVETYPE() function and when it returns 3 using DIRECTORY() funtion to see if valid directory exists. If so, I've got the drive letter needed. Works great. Thanx again.
>>>>
>>>>You're welcome, Colin. Glad to be of help.
>>>>
>>>>BTW, SYS(5) returns the current default directory (which, depending on circumstances) may or may not return the network drive if that's where the app is located.
>>>
>>>Actually, (from VFP Help) "SYS(5) returns the default drive. SYS(2003) returns the default directory with no drive designator. SYS(5) + SYS(2003) returns the default drive and the directory."
>>>
>>>I'm pretty sure you know this and this is what you meant but I thought I'd clarify for anyone else following this thread.
>>>
>>>Thanx again.
>>
>>Doh! I meant drive. Thanks for the heads up. Some of my apps do a lot of swapping around of the default drive/directory via SET DEFAULT. What I was trying to point out was in a situation like mine, SYS(5) might start out at the local drive, but for one reason or another, might not return the same value at some point or another.
>
>OIC, interesting. So, if a user installs my exe in C:\Program Files\MyappDirectory\ will the combo of SYS(5) + SYS(2003) return this directory as the default drive and directory assuming I haven't changed anything programattically?

It should unless the DEFAULT = setting in your configuration file specifies somewhere else.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform