How do I get the filepath to the current page in my custom plugin

I’m creating a plugin that stores a custom file in a subdirectory of the page being edited when the page is saved. To do this I’m adding a custom form processing action, and in the action the plugin will create a subdirectory. I need to know how to get the file system path to the current page.

Try $mypath = $this->grav['uri'];

Actually it’s just:

$page->filePath()

See the API or view the code.

Not sure how I missed that in the API docs. Thanks.