Пример #1
0
Directory_MTP *Device::GenerateDirectory(Signal &sig, uint32_t storageId, const char *pathName) const
{
	const char *pathNamePartial = nullptr;
	AutoPtr<Directory_MTP> pDirectory(GeneratePartialDirectory(sig, storageId, pathName, &pathNamePartial));
	if (*pathNamePartial != '\0') {
		sig.SetError(ERR_IOError, "specified path doesn't exist");
		return nullptr;
	}
	return pDirectory.release();
}
Пример #2
0
std::list < std::pair <std::string, bool> > GSystemImpl::GetDirEntryList (std::string sPath)
{
	std::list < std::pair <std::string, bool> > lEntryList;

	DIR * pDirectory(NULL);
	struct dirent * pDirEntry (NULL);
	if((pDirectory  = opendir(sPath.c_str())) != NULL)
	{
		while ((pDirEntry = readdir(pDirectory)) != NULL)
		{
			lEntryList.push_back(std::list < std::pair <std::string, bool> >::value_type(pDirEntry->d_name,false));
		}
		closedir(pDirectory);
	}

	return lEntryList;
}