本文整理汇总了C++中AsyncFio::dclose方法的典型用法代码示例。如果您正苦于以下问题:C++ AsyncFio::dclose方法的具体用法?C++ AsyncFio::dclose怎么用?C++ AsyncFio::dclose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsyncFio
的用法示例。
在下文中一共展示了AsyncFio::dclose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readDir
void TocManager::readDir(const char *path, TocNode **node, int level) {
if (level <= 2) { // we don't scan deeper than that
iox_dirent_t dirent;
int fd = fio.dopen(path);
if (fd >= 0) {
while (fio.dread(fd, &dirent) > 0)
if (dirent.name[0] != '.') { // skip '.' and '..'
*node = new TocNode;
(*node)->sub = (*node)->next = NULL;
(*node)->nameLen = strlen(dirent.name);
memcpy((*node)->name, dirent.name, (*node)->nameLen + 1);
if (dirent.stat.mode & FIO_S_IFDIR) { // directory
(*node)->isDir = true;
char nextPath[256];
sprintf(nextPath, "%s%s/", path, dirent.name);
readDir(nextPath, &((*node)->sub), level + 1);
} else
(*node)->isDir = false;
node = &((*node)->next);
}
fio.dclose(fd);
} else
printf("Can't open path: %s\n", path);
}
}
示例2:
bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
//TODO: honor the hidden flag
// dbg_printf("getChildren\n");
if (!_isDirectory)
return false;
if (_isRoot) {
if (g_systemPs2->cdPresent())
list.push_back(new Ps2FilesystemNode("cdfs:"));
if (g_systemPs2->hddPresent())
list.push_back(new Ps2FilesystemNode("pfs0:"));
if (g_systemPs2->usbMassPresent())
list.push_back(new Ps2FilesystemNode("mass:"));
if (g_systemPs2->netPresent())
list.push_back(new Ps2FilesystemNode("host:"));
if (g_systemPs2->mcPresent())
list.push_back(new Ps2FilesystemNode("mc0:"));
return true;
} else {
int fd;
if (_path == "pfs0:")
fd = fio.dopen("pfs0:/");
else
fd = fio.dopen(_path.c_str());
// dbg_printf("dopen = %d\n", fd);
if (fd >= 0) {
iox_dirent_t dirent;
Ps2FilesystemNode dirEntry;
int dreadRes;
while ((dreadRes = fio.dread(fd, &dirent)) > 0) {
if (dirent.name[0] == '.')
continue; // ignore '.' and '..'
if ( (mode == Common::FSNode::kListAll) ||
((mode == Common::FSNode::kListDirectoriesOnly) &&
(dirent.stat.mode & FIO_S_IFDIR)) ||
((mode == Common::FSNode::kListFilesOnly) &&
!(dirent.stat.mode & FIO_S_IFDIR)) ) {
dirEntry._isHere = true;
dirEntry._isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR);
dirEntry._isRoot = false;
dirEntry._path = _path;
dirEntry._path += dirent.name;
if (dirEntry._isDirectory && dirEntry._path.lastChar() != '/')
dirEntry._path += '/';
dirEntry._displayName = dirent.name;
dirEntry._verified = true;
list.push_back(new Ps2FilesystemNode(&dirEntry));
}
}
fio.dclose(fd);
return true;
}
}
return false;
}