mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-13 06:18:55 +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:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user