<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/TorConfiguration/dataDirectory",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor0A13ConfigurationV13dataDirectorySSvp"
  },
  "title" : "dataDirectory"
}
-->

# dataDirectory

Filesystem path where Tor will store persistent state.

```
var dataDirectory: String
```

## Discussion

Maps to torrc `DataDirectory` (tor.1.txt). Tor creates
subdirectories for keys (`keys/`), cached network state
(`cached-*`), and lock files. The directory is created if it does
not exist — the parent must be writable by the current process.

- Typical values: a UUID-suffixed path under
  `FileManager.default.temporaryDirectory` for per-session use
  (see ``doc://Tor/documentation/Tor/TorConfiguration/ephemeral(cacheDirectory:)``), or a stable app-scoped
  path under `Application Support` / `.local/share` for
  long-running clients.

> Important: Never point multiple concurrent Tor instances at the
> same `dataDirectory` — Tor enforces a lockfile and the second
> process will fail to start with
> ``doc://Tor/documentation/Tor/TorError/startFailed(_:)``.