canonicalizeFilename

fun canonicalizeFilename(filename: String, relativeTo: String? = null): String

Gets the canonical file name from @filename. All triple slashes are turned into single slashes, and all .. and .s resolved against @relative_to.

Symlinks are not followed, and the returned path is guaranteed to be absolute.

If @filename is an absolute path, @relative_to is ignored. Otherwise,

Return

a newly allocated string with the canonical file path

Since

2.58

Parameters

filename

the name of the file

relativeTo

the relative directory, or null to use the current working directory