Fix path.exists deprecation

Jira: WP-1325