本文整理汇总了C++中FileInfo::FindChild方法的典型用法代码示例。如果您正苦于以下问题:C++ FileInfo::FindChild方法的具体用法?C++ FileInfo::FindChild怎么用?C++ FileInfo::FindChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileInfo
的用法示例。
在下文中一共展示了FileInfo::FindChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strdup
void
Scanner::_ChangeToDesired()
{
if (fBusy || fDesiredPath.size() <= 0)
return;
char* workPath = strdup(fDesiredPath.c_str());
char* pathPtr = &workPath[1]; // skip leading '/'
char* endOfPath = pathPtr + strlen(pathPtr);
// Check the name of the root directory. It is a special case because
// it has no parent data structure.
FileInfo* checkDir = fSnapshot->rootDir;
FileInfo* prefDir = NULL;
char* sep = strchr(pathPtr, '/');
if (sep != NULL)
*sep = '\0';
if (strcmp(pathPtr, checkDir->ref.name) == 0) {
// Root directory matches, so follow the remainder of the path as
// far as possible.
prefDir = checkDir;
pathPtr += 1 + strlen(pathPtr);
while (pathPtr < endOfPath) {
sep = strchr(pathPtr, '/');
if (sep != NULL)
*sep = '\0';
checkDir = prefDir->FindChild(pathPtr);
if (checkDir == NULL || checkDir->children.size() == 0)
break;
pathPtr += 1 + strlen(pathPtr);
prefDir = checkDir;
}
}
// If the desired path is the volume's root directory, default to the
// volume display.
if (prefDir == fSnapshot->rootDir)
prefDir = NULL;
ChangeDir(prefDir);
free(workPath);
fDesiredPath.erase();
}