[libcxx] Avoid intermediate string objects for substrings in windows operator/=

Check that appends with a path object doesn't do allocations, even
on windows.

Suggested by Marek in D98398. The patch might apply without D98398
(depending on how much of the diff context has to match), but doesn't
make much sense until after that patch has landed.

Differential Revision: https://reviews.llvm.org/D98412

GitOrigin-RevId: 49173ca4db21e4d1576c2440b79ebff48c6c4156
2 files changed