コード例 #1
0
	directory_iterator::directory_iterator(const path& p) {


		error_code ec;

		open_dir(p, ec);
		if (ec) throw filesystem_error("directory_iterator::directory_iterator", p, ec);

		increment(ec);
		if (ec) throw filesystem_error("directory_iterator::directory_iterator", p, ec);
	}
コード例 #2
0
	directory_iterator& directory_iterator::operator++() {

		error_code ec;

		increment(ec);
		if (ec) throw filesystem_error("directory_iterator::operator++", ec);

		return *this;
	}
コード例 #3
0
ファイル: FsUtil.cpp プロジェクト: GYGit/folly
path remove_prefix(const path& pth, const path& prefix) {
  path::const_iterator it;
  if (!skipPrefix(pth, prefix, it)) {
    throw filesystem_error(
        "Path does not start with prefix",
        pth, prefix,
        bsys::errc::make_error_code(bsys::errc::invalid_argument));
  }

  path p;
  for (; it != pth.end(); ++it) {
    p /= *it;
  }

  return p;
}