Instance Property

file​System​Representation

A file system-specific representation of the receiver.

Declaration

var fileSystemRepresentation: UnsafePointer<Int8> { get }

Discussion

The returned C string will be automatically freed just as a returned object would be released; your code should copy the representation or use get​File​System​Representation(_:​max​Length:​) if it needs to store the representation outside of the memory context in which the representation was created.

Raises an character​Conversion​Exception if the receiver can’t be represented in the file system’s encoding. It also raises an exception if the receiver contains no characters.

Note that this method only works with file paths (not, for example, string representations of URLs).

To convert a char * path (such as you might get from a C library routine) to an NSString object, use the string(with​File​System​Representation:​length:​) method on File​Manager.