This method returns the number of characters copied into the
string buffer, not including the terminating null character. If the
lpszNormalized parameter is NULL, it will return the length
of the normalized path but will not copy any characters. If the
method fails, it will return FTP_ERROR. To get extended error
information, call GetLastError.
This method will accept a relative or absolute file path on the
server and return a normalized version of that path. Normalization
will remove extraneous path delimiters and collapse the path if there
are references to parent directories. For example, if the current
working directory for the user is /home/jsmith and the
file path provided is:
./text/..//data//./files/filename.txt
This method would return the following as the normalized path:
/home/jsmith/data/files/filename.txt
Because the path is relative, the current working directory for the
client would be used to create an absolute path. The extraneous path
delimiters are removed (the double slashes) and the reference to the
parent directory is collapsed to produce a simple, uniform path. This
can be useful both for display purposes and to normalize input
provided by a user.
If a connection has not been established with a server, relative file paths will
not be normalized as absolute paths because there is no current
working directory available. This allows the method to be used
without an active connection, removing any extraneous path delimiters
and collapsing the path without returning an absolute path unless one
was provided.
If the path specified by the lpszFilePath parameter is
relative to the current directory and there is no active connection,
the normalized path returned by the method will always be relative.
For example, if the path provided is:
../../../../../data/filename.txt
This method would return the following as the normalized path:
data/filename.txt
Because the original path was relative, the normalized path is also
relative and will not begin with a leading path delimiter. It is
intentionally designed this way to prevent the path from "escaping" to
the root directory of a file system, which can present a security
risk. If the original path was absolute, the normalized path would
also be absolute.
This method will accept an FTP URL and return only the normalized path
and file name potion of the URL. If you need to normalize a complete
URL, use the NormalizeUrl method.