StringRef p(path.data(), path.size());
bool rootDirectory = path::has_root_directory(p);
- bool rootName =
- (real_style(Style::native) != Style::windows) || path::has_root_name(p);
+ bool rootName = path::has_root_name(p);
// Already absolute.
- if (rootName && rootDirectory)
+ if ((rootName || real_style(Style::native) != Style::windows) &&
+ rootDirectory)
return;
// All of the following conditions will need the current directory.
path::native(*i, temp_store);
}
- SmallString<32> Relative("foo.cpp");
- sys::fs::make_absolute("/root", Relative);
- Relative[5] = '/'; // Fix up windows paths.
- ASSERT_EQ("/root/foo.cpp", Relative);
+ {
+ SmallString<32> Relative("foo.cpp");
+ sys::fs::make_absolute("/root", Relative);
+ Relative[5] = '/'; // Fix up windows paths.
+ ASSERT_EQ("/root/foo.cpp", Relative);
+ }
+
+ {
+ SmallString<32> Relative("foo.cpp");
+ sys::fs::make_absolute("//root", Relative);
+ Relative[6] = '/'; // Fix up windows paths.
+ ASSERT_EQ("//root/foo.cpp", Relative);
+ }
}
TEST(Support, FilenameParent) {