<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/FilePath/Root-swift.struct/init(platformString:)-3s0ol",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System8FilePathV4RootV14platformStringAESgSays4Int8VG_tcfc"
  },
  "title" : "init(platformString:)"
}
-->

# init(platformString:)

Creates a file path root by copying bytes from a null-terminated platform
string. It is a precondition that a null byte indicates the end of
the string. The absence of a null byte will trigger a runtime error.

```
init?(platformString: [CInterop.PlatformChar])
```

## Parameters

`platformString`

A null-terminated platform string.

## Discussion

Returns `nil` if `platformString` is empty or is not a root.

- Note It is a precondition that `platformString` must be null-terminated.
  The absence of a null byte will trigger a runtime error.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)