Rewrite with-permissions macro to use File.canWrite