Use CFURLCopyLastPathComponent() for directory URL generation

Ensures %2F is reasonably kept in place
Settle for double slash in directory-adjusted URLs