---
title: filePath()
framework: swift
role: symbol
role_heading: Macro
path: swift/filepath()
---

# filePath()

Produces the complete path to the file in which the macro appears.

## Declaration

```swift
@freestanding(expression) macro filePath<T>() -> T where T : ExpressibleByStringLiteral
```

## Overview

Overview Because #fileID doesn’t embed the full path to the source file, unlike #filePath, it gives you better privacy and reduces the size of the compiled binary. Avoid using #filePath outside of tests, build scripts, or other code that doesn’t become part of the shipping program. This macro’s value can be changed by #sourceLocation, as described in Line Control Statement in The Swift Programming Language.

## See Also

### Getting Source Location Information

- [file()](swift/file().md)
- [fileID()](swift/fileid().md)
- [function()](swift/function().md)
- [line()](swift/line().md)
- [column()](swift/column().md)
