Depending on the details, the standard ANSI CL function enough-namestring might be useful.
Unfortunately, the behavior of CL pathname functions is (in any practical sense) rather underspecified because there are so many filesystem platforms with various quirks, some of which (both filesystems and quirks!) didn't even exist when the ANS was finalized.