46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
|
<%
|
||
|
Private Function PrettyPath(ByVal sPath, ByVal hLen, ByVal bFile, ByVal bExtOnly)
|
||
|
Dim elements, i, tmp, bLast, sElm, sDelim, chopsize
|
||
|
Dim showfullfilename, showfileextension
|
||
|
|
||
|
chopsize = hLen
|
||
|
showfullfilename = bFile
|
||
|
showfileextension = bExtOnly
|
||
|
|
||
|
If IsNull(chopsize) Then chopsize = 3
|
||
|
If IsNull(showfullfilename) Then showfullfilename = False
|
||
|
If IsNull(showfileextension) Then showfileextension = True
|
||
|
|
||
|
bLast = False
|
||
|
sDelim = ""
|
||
|
If InStr(sPath, sDelim) = 0 Then sDelim = "/"
|
||
|
elements = Split(sPath, sDelim)
|
||
|
|
||
|
For i = 0 To UBound(elements)
|
||
|
sElm = elements(i)
|
||
|
If Len(sElm) > 5 Then
|
||
|
If i = UBound(elements) Then
|
||
|
If showfullfilename Then
|
||
|
tmp = ""
|
||
|
Exit For
|
||
|
ElseIf showfileextension Then
|
||
|
tmp = Right(sElm, Len(sElm) - _
|
||
|
InStrRev(sElm, "."))
|
||
|
bLast = True
|
||
|
End If
|
||
|
End If
|
||
|
If chopsize > 0 Then
|
||
|
elements(i) = Left(sElm, chopsize) & "..."
|
||
|
Else
|
||
|
elements(i) = "..."
|
||
|
End If
|
||
|
If showfileextension And bLast Then
|
||
|
elements(i) = elements(i) & tmp
|
||
|
End If
|
||
|
End If
|
||
|
Next
|
||
|
PrettyPath = Join(elements, sDelim)
|
||
|
End Function
|
||
|
%>
|
||
|
|