Contents

init(decoding:)

Creates a string by interpreting the file path’s content as UTF-8 on Unix and UTF-16 on Windows.

Declaration

init(decoding path: FilePath)

Parameters

  • path:

    The file path to be interpreted as CInterop.PlatformUnicodeEncoding.

Discussion

If the content of the file path isn’t a well-formed Unicode string, this initializer replaces invalid bytes with U+FFFD. This means that, depending on the semantics of the specific file system, conversion to a string and back to a path might result in a value that’s different from the original path.

See Also

Creating a String