You probably need to use
```
var file = FileSystem.getFileForPath(filePath);
```