예제 #1
0
FileReader::FileReader(const std::string& path)
: m_fd(-1)
{
	m_fd = ::open(path.c_str(), O_RDONLY);

	if (m_fd == -1)
	{
#ifdef DEBUG
		std::cerr << "Cannot open " << path << ": " << strerror(errno) << std::endl;
#endif
		throw file_not_found_error(path);
	}
}
예제 #2
0
파일: repo.cpp 프로젝트: kluete/libgit2cpp
    git_status_t Repository::file_status(const char * filepath) const
    {
        git_status_t res;
        switch (git_status_file(reinterpret_cast<unsigned int *>(&res), repo_, filepath))
        {
        case GIT_ENOTFOUND:
            throw file_not_found_error(filepath);
        case GIT_EAMBIGUOUS:
            throw ambiguous_path_error(filepath);
        case -1:
            throw unknown_file_status_error(filepath);
        }

        return res;
    }