mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-16 23:19:37 +00:00
Convert from Windows to Unix paths in sys::path::native.
Part of pr20544. Test to follow in a second. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215241 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
996a304351
commit
a7c6b3a57a
@ -540,9 +540,19 @@ void native(const Twine &path, SmallVectorImpl<char> &result) {
|
|||||||
native(result);
|
native(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void native(SmallVectorImpl<char> &path) {
|
void native(SmallVectorImpl<char> &Path) {
|
||||||
#ifdef LLVM_ON_WIN32
|
#ifdef LLVM_ON_WIN32
|
||||||
std::replace(path.begin(), path.end(), '/', '\\');
|
std::replace(path.begin(), path.end(), '/', '\\');
|
||||||
|
#else
|
||||||
|
for (auto PI = Path.begin(), PE = Path.end(); PI < PE; ++PI) {
|
||||||
|
if (*PI == '\\') {
|
||||||
|
auto PN = PI + 1;
|
||||||
|
if (PN < PE && *PN == '\\')
|
||||||
|
++PI; // increment once, the for loop will move over the escaped slash
|
||||||
|
else
|
||||||
|
*PI = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user