Avoid using toPath for Java 6 compatibility.