Skip to content

Commit af2c165

Browse files
committed
[llvm][Support][Windows] Fix slash in path for remove_directories
Before 925471e remove_directories supports path with slash (instead of backslash). The ILCreateFromPathW in new implementation requirs backslash path, so the call to remove_directories will fail if the path contains slash. This is to normalize the path to make sure remove_directories still support path with slash as well.
1 parent 1a0d0ae commit af2c165

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Support/Windows/Path.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,9 +1373,11 @@ std::error_code closeFile(file_t &F) {
13731373
}
13741374

13751375
std::error_code remove_directories(const Twine &path, bool IgnoreErrors) {
1376+
SmallString<128> NativePath;
1377+
llvm::sys::path::native(path, NativePath, path::Style::windows_backslash);
13761378
// Convert to utf-16.
13771379
SmallVector<wchar_t, 128> Path16;
1378-
std::error_code EC = widenPath(path, Path16);
1380+
std::error_code EC = widenPath(NativePath, Path16);
13791381
if (EC && !IgnoreErrors)
13801382
return EC;
13811383

0 commit comments

Comments
 (0)