本文整理汇总了C++中BFile::IsDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ BFile::IsDirectory方法的具体用法?C++ BFile::IsDirectory怎么用?C++ BFile::IsDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFile
的用法示例。
在下文中一共展示了BFile::IsDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/*
* Given a directory, subscribe to Node Monitor
* messages on it and all it's descendents.
* For all directories, use B_WATCH_DIRECTORY.
* For all file, use B_WATCH_STAT.
* It also watches the directory itself
* with B_WATCH_DIRECOTRY.
*/
void
App::recursive_watch(BDirectory *dir)
{
status_t err;
BEntry entry;
err = dir->GetNextEntry(&entry);
//for each file in the current directory
while(err == B_OK)
{
//put this file in global list
this->track_file(&entry);
BFile file = BFile(&entry,B_READ_ONLY);
if(file.IsDirectory())
{
watch_entry(&entry,B_WATCH_DIRECTORY);
BDirectory *ndir = new BDirectory(&entry);
this->recursive_watch(ndir);
delete ndir;
}
else
{
watch_entry(&entry,B_WATCH_STAT);
}
err = dir->GetNextEntry(&entry);
}
}
示例2: appInfo
status_t
CreateAppMetaMimeThread::DoMimeUpdate(const entry_ref* ref, bool* _entryIsDir)
{
if (ref == NULL)
return B_BAD_VALUE;
BNode typeNode;
BFile file;
status_t status = file.SetTo(ref, B_READ_ONLY);
if (status < B_OK)
return status;
bool isDir = file.IsDirectory();
if (_entryIsDir != NULL)
*_entryIsDir = isDir;
if (isDir)
return B_OK;
BAppFileInfo appInfo(&file);
status = appInfo.InitCheck();
if (status < B_OK)
return status;
// Read the app sig (which consequently keeps us from updating
// non-applications, since we get an error if the file has no
// app sig)
BString signature;
status = file.ReadAttrString("BEOS:APP_SIG", &signature);
if (status < B_OK)
return B_BAD_TYPE;
// Init our various objects
BMimeType mime;
status = mime.SetTo(signature.String());
if (status < B_OK)
return status;
InstallNotificationDeferrer _(fDatabase, signature.String());
if (!mime.IsInstalled())
mime.Install();
BString path = "/";
path.Append(signature);
path.ToLower();
// Signatures and MIME types are case insensitive, but we want to
// preserve the case wherever possible
path.Prepend(get_database_directory().c_str());
status = typeNode.SetTo(path.String());
if (status < B_OK)
return status;
// Preferred App
attr_info info;
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kPreferredAppAttr, &info) != B_OK))
status = mime.SetPreferredApp(signature.String());
// Short Description (name of the application)
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kShortDescriptionAttr, &info) != B_OK))
status = mime.SetShortDescription(ref->name);
// App Hint
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kAppHintAttr, &info) != B_OK))
status = mime.SetAppHint(ref);
// Vector Icon
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kIconAttr, &info) != B_OK)) {
uint8* data = NULL;
size_t size = 0;
if (appInfo.GetIcon(&data, &size) == B_OK) {
status = mime.SetIcon(data, size);
free(data);
}
}
// Mini Icon
BBitmap miniIcon(BRect(0, 0, 15, 15), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kMiniIconAttr, &info) != B_OK)) {
if (appInfo.GetIcon(&miniIcon, B_MINI_ICON) == B_OK)
status = mime.SetIcon(&miniIcon, B_MINI_ICON);
}
// Large Icon
BBitmap largeIcon(BRect(0, 0, 31, 31), B_BITMAP_NO_SERVER_LINK, B_CMAP8);
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kLargeIconAttr, &info) != B_OK)) {
if (appInfo.GetIcon(&largeIcon, B_LARGE_ICON) == B_OK)
status = mime.SetIcon(&largeIcon, B_LARGE_ICON);
}
// Supported Types
bool setSupportedTypes = false;
BMessage supportedTypes;
if (status == B_OK && (fForce || typeNode.GetAttrInfo(kSupportedTypesAttr, &info) != B_OK)) {
if (appInfo.GetSupportedTypes(&supportedTypes) == B_OK)
setSupportedTypes = true;
}
// defer notifications for supported types
//.........这里部分代码省略.........