Click or drag to resize

DisplayPath Function

X#
-- todo --
Truncates long path expressions to a specified length for display.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION DisplayPath(
	cFilename,
	nMaxLength
) AS USUAL CLIPPER
Request Example View Source

Parameters

cFilename (Optional)
Type: Usual
Specifies the name of the file at the end of the target path. If you specify a string containing only spaces as cFileName, X# returns the current directory. If you specify an empty string as cFileName, DisplayPath( ) returns an empty string. You can obtain the path of the current directory by using the CurDir( ).
This function does not check the validity of cFileName and will report the truncated path expression even if no such file exists.
nMaxLength (Optional)
Type: Usual
Specifies the maximum length of the truncated result. nMaxLength must be greater than or equal to 10 and less than or equal to 260 Character data type. DisplayPath( ) returns a string and displays the path in lower case.

Return Value

Type: Usual
Remarks
DisplayPath( ) returns a string suitable only for display purposes, so you cannot use the result to reference a file. The length of the resulting string is equal to or less than nMaxLength. However, the result does not break directory names. If inclusion of a directory name would exceed nMaxLength, the result is an ellipsis (...). If the filename exceeds nMaxLength, the result is the filename plus extension.
See Also