Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DOS Compliant Folder names
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01007482
Message ID:
01007519
Vues:
9
>This is a good one.
>
>In VFP 7 when you used Getdir() it would return a DOS compliant folder name something like C:\DOCUME~1\MARK\LOCALS~1\TEMP
>
>In 9 if the original directory name is DOS compliant it will use ~ and stuff until you go to the root, then it will return the full folder name with spaces and stuff.
>
>I have an application that was written in 7 or earlier, there are quite a few places where I will have to go and put quotes around variables.
>
>I would prefer not to do this. Do y’all know of a way to get a DOS compliant folder name from one with the spaces and stuff, and vice versa.
>
>For example:
>C:\Program Files\ApplicationDir to c:\Progra~1\Applic~1 and back.
>
>I'm just guessing on how the translation is actually done.
>
>TIA
Thank y'all very much.
I went with something similar to Don's solution.
Procedure DosPathToFullPath
lParameters pcFullPath as String
Local lcDrive as String
Local lcRetval as String
Local lnSlashCount as Integer 
Local lnCount as Integer
Local aPath[1]
lcRetVal = ''
**
**   Get the Drive Letter first.
**
lcDrive = Left(pcFullPath,At(':',pcFullPath))
**
**   Loop thru all the slashes and build the return string
**
lcRetVal = lcDrive
lnSlashCount = Occurs('\',pcFullPath)
For lnCount = 2 to lnSlashCount
   =ADir(aPath,Left(pcFullPath,At('\',pcFullPath,lnCount)-1),"D")
   lcRetVal = lcRetVal + '\' + aPath[1]
EndFor
Return lcRetVal+'\'

Procedure FullPathToDosPath
lParameters pcDosPath as String
Local lcDrive as String
Local lcRetval as String
Local lnSlashCount as Integer 
Local lnCount as Integer
Local aPath[1]
lcRetVal = ''
**
**   Get the Drive Letter first.
**
lcDrive = Left(pcDosPath,At(':',pcDosPath))
**
**   Loop thru all the slashes and build the return string
**
lcRetVal = lcDrive
lnSlashCount = Occurs('\',pcDosPath)
For lnCount = 2 to lnSlashCount
   =ADir(aPath,Left(pcDosPath,At('\',pcDosPath,lnCount)-1),"D",2)
   lcRetVal = lcRetVal + '\' + aPath[1]
EndFor
Return lcRetVal+'\'
Mark S. Swiencki
EPS Software www.eps-software.com
mark@eps-software.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform