For cases where path is coming through as a Pathname object, this converts it to a string to avoid an error on the following line.