Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fullpath() returns uppercase
Message
De
30/09/2019 13:42:05
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
30/09/2019 07:03:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01671252
Message ID:
01671268
Vues:
67
>How about this one?

Quite good... a bit pedestrian but then since aDir() won't tackle more than a single directory level, it has to be. Just at the end, nowadays, if I was writing this, I'd use rtrim(..., 1, "\") instead of if/endif. Which I usually forget to do :).

>
* Receives a path, file or path+file and returns the case sensitive format.
>* The getfile() and getdir() functions only return a case insensitive path/file.
>* This routine must tackle that shortcoming.
>
>* Changes:
>*	30/jun/2006 pdv	Created.
>*	03/sep/2009 pdv	Can now also handle an URL. (added 22/dec/2009)
>
>FUNCTION CaseSensitive
>	lparameter tcPF
>
>	local lcPF, lnFnd, ln
>	local array laPF[1], laDir[1]
>
>	lcPF  = ''
>	lnFnd = alines( laPF, m.tcPF, .t., '\' )
>
>	for ln = 1 to m.lnFnd
>		*
>		do case
>		case laPF[ m.ln ] == ''										&& will be the case if it is an URL, like '\\Server\Folder\File.txt'
>		case m.lcPF == '\\'											&& then simply accept the server's ref.
>		case substr( laPF[ m.ln ], 2, 1 ) = ':'						&& if root
>			*
>			laPF[ m.ln ] = upper( laPF[ m.ln ] )					&& then upper case
>
>		case adir( laDir, lcPF + '\' + laPF[ m.ln ], 'D', 1 ) = 1	&& if map exists
>			*
>			laPF[ m.ln ] = laDir[ 1, 1 ]							&& then replace with casesensitive string
>
>		endcase
>		*
>		lcPF = m.lcPF + laPF[ m.ln ] + '\'
>	next
>
>	if right( m.tcPF, 1 ) # '\'
>		*
>		lcPF = left( m.lcPF, len( m.lcPF ) - 1 )
>	endif
>
>	RETURN m.lcPF
>
>
>>Nitpicking a little... In my routine which moves the raw pictures from wherever they were found (memory card, temp folder, usb connected phone etc) into appropriate folder, the final part was
>>
>>
			lcToFile=Fullpath(Forcepath(lcToFile,lcToDir))
>>			Rename (lcFromFile) To (lcToFile)
>>...which turned the whole content of lcToFile into uppercase, regardless of the case in lcToFile,lcToDir. Now since lcToDir is mostly digits (it's date based), this workaround works:
>>
			lcToFile=Forcepath(lcToFile,Fullpath(lcToDir))
>>			Rename (lcFromFile) To (lcToFile)
>>- now only the folder is uppercase, the filename remains as it was, which is what I wanted. Still, is there a way to have FullPath() return the path as it is on disk, not uppercased? Is there an alternative? Scripting host would work as well.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform