diff options
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Unix/Path.inc | 13 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index 2b29baca73..500b7fecb7 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -272,6 +272,19 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) { return error_code::success(); } +error_code normalize_separators(SmallVectorImpl<char> &Path) { + 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 = '/'; + } + } + return error_code::success(); +} + // Note that we are using symbolic link because hard links are not supported by // all filesystems (SMB doesn't). error_code create_link(const Twine &to, const Twine &from) { diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index a555f3e794..e59888e385 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -158,6 +158,11 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) { return error_code::success(); } +error_code normalize_separators(SmallVectorImpl<char> &Path) { + (void) Path; + return error_code::success(); +} + // We can't use symbolic links for windows. error_code create_link(const Twine &to, const Twine &from) { // Get arguments. |