remove() implementation
| 1092 | |
| 1093 | //! remove() implementation |
| 1094 | inline bool remove_impl(path const& p, error_code* ec) |
| 1095 | { |
| 1096 | // Since POSIX remove() is specified to work with either files or directories, in a |
| 1097 | // perfect world it could just be called. But some important real-world operating |
| 1098 | // systems (Windows, Mac OS, for example) don't implement the POSIX spec. So |
| 1099 | // we have to distinguish between files and directories and call corresponding APIs |
| 1100 | // to remove them. |
| 1101 | |
| 1102 | error_code local_ec; |
| 1103 | fs::file_type type = fs::detail::symlink_status_impl(p, &local_ec).type(); |
| 1104 | if (BOOST_UNLIKELY(type == fs::status_error)) |
| 1105 | { |
| 1106 | if (!ec) |
| 1107 | BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::remove", p, local_ec)); |
| 1108 | |
| 1109 | *ec = local_ec; |
| 1110 | return false; |
| 1111 | } |
| 1112 | |
| 1113 | return fs::detail::remove_impl(p, type, ec); |
| 1114 | } |
| 1115 | |
| 1116 | //! remove_all() implementation |
| 1117 | uintmax_t remove_all_impl |
no test coverage detected