Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the a file name with proper case
Message
De
14/10/2010 20:58:18
 
 
À
20/08/2010 15:39:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00766432
Message ID:
01485542
Vues:
76
>>>>VFP has the unfortunate problem that all path related functions return filenames and paths in UPPER case. For example, GetFile() returns upper case as does FULLPATH() and even the varoius SYS() functions related to directory values return upper case.
>>>>
>>>>Does anybody know of an API call that you can pass a file or directory path to that will return the fully qualified long filename in proper case back? At least that way I can retrieve the filename and then later convert it into the proper case.
>>>>
>>>>I've played around GetLongPathName and GetFullPathName but neither of these seem to work and simply return the same case as what was passed in. THey basically confirm the file name and that the file exists.
>>>
>>>Rick,
>>>
>>>You can also use the Scripting.FileSystemObject to retrieve long filenames and paths in proper case, see Path property of Folder and File objects.
>>>
oFSO = CreateObject( "Scripting.FileSystemObject")
>>>lcFile = GetFile()
>>>oFolder = oFSO.GetFolder( JustPath( lcFile))
>>>oFile = oFSO.GetFile( lcFile)
>>>?oFile.Path
>>>?oFolder.Path
>>>?JustFName( oFile.Path)
>>>
>>>
>>Small corrections, you may use the Name property of the File object instead of JustFName() function.
>
>Hi,
>
>In my Win7 + VFP9.2 JustFame( oFile.Path) works fine - Name( oFile.Path) errors : "File 'name.prg' does not exists.
>
>A very fine elegant solution.
>Regards,
>Koen

I did mean the Name property of the File object, and not the Name() function:
?oFile.Name
instead of:
?JustFName( oFile.Path)
With best regards,
Alex
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform