Removes a single filename component.
(none)
*this
#include <filesystem> #include <iostream> int main() { std::cout << std::fs::path("/foo").remove_filename() << '\n'; std::cout << std::fs::path("/").remove_filename() << '\n'; }
Output:
/