return false;
}
- file_status st = symlink_status(p, ec);
+ file_status st = status(p, ec);
if (is_directory(st))
return false;
else if (ec && !status_known(st))
return false;
}
- file_status st = symlink_status(p, ec);
+ file_status st = status(p, ec);
if (is_directory(st))
return false;
else if (ec && !status_known(st))
remove_all(p);
}
+void
+test04()
+{
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // no symlinks
+#else
+ // PR libstdc++/101510
+ // create_directories reports an error if the path is a symlink to a dir
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
+ const auto p = __gnu_test::nonexistent_path() / "";
+ fs::create_directories(p/"dir");
+ auto link = p/"link";
+ fs::create_directory_symlink("dir", link);
+ bool created = fs::create_directories(link, ec);
+ VERIFY( !created );
+ VERIFY( !ec );
+ created = fs::create_directories(link);
+ VERIFY( !created );
+ remove_all(p);
+#endif
+}
+
int
main()
{
test01();
test02();
test03();
+ test04();
}
VERIFY( e.path1() == f );
}
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // no symlinks
+#else
// PR libstdc++/101510 create_directory on an existing symlink to a directory
fs::create_directory(p/"dir");
auto link = p/"link";
VERIFY( !ec );
b = fs::create_directory(link);
VERIFY( !b );
+#endif
remove_all(p, ec);
}
remove_all(p);
}
+void
+test04()
+{
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // no symlinks
+#else
+ // PR libstdc++/101510
+ // create_directories reports an error if the path is a symlink to a dir
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
+ const auto p = __gnu_test::nonexistent_path() / "";
+ fs::create_directories(p/"dir");
+ auto link = p/"link";
+ fs::create_directory_symlink("dir", link);
+ bool created = fs::create_directories(link, ec);
+ VERIFY( !created );
+ VERIFY( !ec );
+ created = fs::create_directories(link);
+ VERIFY( !created );
+ remove_all(p);
+#endif
+}
+
int
main()
{
test01();
test02();
test03();
+ test04();
}
VERIFY( e.path1() == f );
}
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ // no symlinks
+#else
// PR libstdc++/101510 create_directory on an existing symlink to a directory
fs::create_directory(p/"dir");
auto link = p/"link";
VERIFY( !ec );
b = fs::create_directory(link);
VERIFY( !b );
+#endif
remove_all(p, ec);
}