本文整理汇总了C++中Entry::SetSeen方法的典型用法代码示例。如果您正苦于以下问题:C++ Entry::SetSeen方法的具体用法?C++ Entry::SetSeen怎么用?C++ Entry::SetSeen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::SetSeen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleEntry
virtual status_t HandleEntry(BPackageEntry* entry)
{
// create a token
Token* token = new(std::nothrow) Token;
if (token == NULL)
return B_NO_MEMORY;
ObjectDeleter<Token> tokenDeleter(token);
// check whether this entry shall be ignored or is implicit
Entry* parentFilterEntry;
bool implicit;
if (entry->Parent() != NULL) {
Token* parentToken = (Token*)entry->Parent()->UserToken();
if (parentToken == NULL) {
// parent is ignored, so ignore this entry, too
return B_OK;
}
parentFilterEntry = parentToken->filterEntry;
implicit = parentToken->implicit;
} else {
parentFilterEntry = &fRootFilterEntry;
implicit = fRootFilterEntry.IsImplicit();
}
Entry* filterEntry = parentFilterEntry != NULL
? parentFilterEntry->FindChild(entry->Name()) : NULL;
if (implicit && filterEntry == NULL) {
// parent is implicit and the filter doesn't include this entry
// -- ignore it
return B_OK;
}
// If the entry is in the filter, get its implicit flag.
if (filterEntry != NULL) {
implicit = filterEntry->IsImplicit();
filterEntry->SetSeen();
}
token->filterEntry = filterEntry;
token->implicit = implicit;
// get parent FD and the entry name
int parentFD;
const char* entryName;
_GetParentFDAndEntryName(entry, parentFD, entryName);
// check whether something is in the way
struct stat st;
bool entryExists = fstatat(parentFD, entryName, &st,
AT_SYMLINK_NOFOLLOW) == 0;
if (entryExists) {
if (S_ISREG(entry->Mode()) || S_ISLNK(entry->Mode())) {
// If the entry in the way is a regular file or a symlink,
// remove it, otherwise fail.
if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) {
fprintf(stderr, "Error: Can't create entry \"%s\", since "
"something is in the way\n",
_EntryPath(entry).String());
return B_FILE_EXISTS;
}
if (unlinkat(parentFD, entryName, 0) != 0) {
fprintf(stderr, "Error: Failed to unlink entry \"%s\": %s\n",
_EntryPath(entry).String(), strerror(errno));
return errno;
}
entryExists = false;
} else if (S_ISDIR(entry->Mode())) {
// If the entry in the way is a directory, merge, otherwise
// fail.
if (!S_ISDIR(st.st_mode)) {
fprintf(stderr, "Error: Can't create directory \"%s\", "
"since something is in the way\n",
_EntryPath(entry).String());
return B_FILE_EXISTS;
}
}
}
// create the entry
int fd = -1;
if (S_ISREG(entry->Mode())) {
if (implicit) {
fprintf(stderr, "Error: File \"%s\" was specified as a "
"path directory component.\n", _EntryPath(entry).String());
return B_BAD_VALUE;
}
// create the file
fd = openat(parentFD, entryName, O_RDWR | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR);
// Note: We use read+write user permissions now -- so write
// operations (e.g. attributes) won't fail, but set them to the
// desired ones in HandleEntryDone().
if (fd < 0) {
fprintf(stderr, "Error: Failed to create file \"%s\": %s\n",
_EntryPath(entry).String(), strerror(errno));
//.........这里部分代码省略.........