static char *getMountPoint(const char *devname, char *buf, size_t bufsize) { BVolumeRoster mounts; BVolume vol; mounts.Rewind(); while (mounts.GetNextVolume(&vol) == B_NO_ERROR) { fs_info fsinfo; fs_stat_dev(vol.Device(), &fsinfo); if (strcmp(devname, fsinfo.device_name) == 0) { BDirectory directory; BEntry entry; BPath path; const char *str; if ( (vol.GetRootDirectory(&directory) < B_OK) || (directory.GetEntry(&entry) < B_OK) || (entry.GetPath(&path) < B_OK) || ( (str = path.Path()) == NULL) ) return NULL; strncpy(buf, str, bufsize-1); buf[bufsize-1] = '\0'; return buf; } /* if */ } /* while */ return NULL; } /* getMountPoint */
void TTracker::Pulse() { if (!TrackerSettings().ShowVolumeSpaceBar()) return; // update the volume icon's free space bars BVolumeRoster roster; BVolume volume; while (roster.GetNextVolume(&volume) == B_NO_ERROR) { BDirectory dir; volume.GetRootDirectory(&dir); node_ref nodeRef; dir.GetNodeRef(&nodeRef); BMessage notificationMessage; notificationMessage.AddInt32("device", *(int32 *)&nodeRef.device); LockLooper(); SendNotices(kUpdateVolumeSpaceBar, ¬ificationMessage); UnlockLooper(); } }
inline bool QStorageIterator::next() { BVolume volume; if (m_volumeRoster.GetNextVolume(&volume) != B_OK) return false; BDirectory directory; if (volume.GetRootDirectory(&directory) != B_OK) return false; const BPath path(&directory); fs_info fsInfo; memset(&fsInfo, 0, sizeof(fsInfo)); if (fs_stat_dev(volume.Device(), &fsInfo) != 0) return false; m_rootPath = path.Path(); m_fileSystemType = QByteArray(fsInfo.fsh_name); const QByteArray deviceName(fsInfo.device_name); m_device = (deviceName.isEmpty() ? QByteArray::number(qint32(volume.Device())) : deviceName); return true; }
static char *getMountPoint(const char *devname) { BVolumeRoster mounts; BVolume vol; mounts.Rewind(); while (mounts.GetNextVolume(&vol) == B_NO_ERROR) { fs_info fsinfo; fs_stat_dev(vol.Device(), &fsinfo); if (strcmp(devname, fsinfo.device_name) == 0) { //char buf[B_FILE_NAME_LENGTH]; BDirectory directory; BEntry entry; BPath path; status_t rc; rc = vol.GetRootDirectory(&directory); BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL); rc = directory.GetEntry(&entry); BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL); rc = entry.GetPath(&path); BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL); const char *str = path.Path(); BAIL_IF_MACRO(str == NULL, ERR_OS_ERROR, NULL); /* ?! */ char *retval = (char *) allocator.Malloc(strlen(str) + 1); BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); strcpy(retval, str); return(retval); } /* if */ } /* while */ return(NULL); } /* getMountPoint */
void PanelView::ReadDisks(void) //////////////////////////////////////////////////////////////////////// { char drivename[256]; char drivepath[256]; // SetMousePointer(CR_HOURGLASS); MAINWINDOW->SetMousePointer(GenesisWindow::CR_HOURGLASS); CustomListItem *item; item = new CustomListItem("..",m_Path.String(),FT_DISKBACK, 0); item->AddIcon(m_ParentIcon); m_CustomListView->AddItem(item); item->SetHeight(15.0f); // Collect available volumes... BVolumeRoster *vr = new BVolumeRoster(); if (vr) { BVolume v; while (vr->GetNextVolume(&v)==B_NO_ERROR) { if (v.GetName(drivename)==B_NO_ERROR) { if (strlen(drivename)>0) { BDirectory dir; BEntry entry; BPath path; v.GetRootDirectory(&dir); dir.GetEntry(&entry); entry.GetPath(&path); sprintf(drivepath,"%s",path.Path()); item = new CustomListItem(drivename,drivepath,FT_DISKITEM,v.FreeBytes(),v.Capacity(),v.Device()); m_CustomListView->AddItem(item); if (m_Setting_ShowIcons) { if (!item->GetIcon(&v)) item->AddIcon(m_UnknownIcon); item->SetHeight(15.0f); } } } } delete vr; } m_CustomListView->DoSortList(); m_CustomListView->Select(0,false); // SetMousePointer(CR_DEFAULT); MAINWINDOW->SetMousePointer(GenesisWindow::CR_DEFAULT); }
/*! \brief Returns the mount point for the partition. If the partition is mounted this is the actual mount point. If it is not mounted, but contains a file system, derived from the partition name the name for a not yet existing directory in the root directory is constructed and the path to it returned. For partitions not containing a file system the method returns an error. \param mountPoint Pointer to the path to be set to refer the mount point (respectively potential mount point) of the partition. \return \c B_OK, if everything went fine, an error code otherwise. */ status_t BPartition::GetMountPoint(BPath* mountPoint) const { if (!mountPoint || !ContainsFileSystem()) return B_BAD_VALUE; // if the partition is mounted, return the actual mount point BVolume volume; if (GetVolume(&volume) == B_OK) { BDirectory dir; status_t error = volume.GetRootDirectory(&dir); if (error == B_OK) error = mountPoint->SetTo(&dir, NULL); return error; } // partition not mounted // get the volume name const char* volumeName = ContentName(); if (!volumeName || strlen(volumeName) == 0) volumeName = Name(); if (!volumeName || strlen(volumeName) == 0) volumeName = "unnamed volume"; // construct a path name from the volume name // replace '/'s and prepend a '/' BString mountPointPath(volumeName); mountPointPath.ReplaceAll('/', '-'); mountPointPath.Insert("/", 0); // make the name unique BString basePath(mountPointPath); int counter = 1; while (true) { BEntry entry; status_t error = entry.SetTo(mountPointPath.String()); if (error != B_OK) return error; if (!entry.Exists()) break; mountPointPath = basePath; mountPointPath << counter; counter++; } return mountPoint->SetTo(mountPointPath.String()); }
void BSlowContextMenu::AddRootItemsIfNeeded() { BVolumeRoster roster; roster.Rewind(); BVolume volume; while (roster.GetNextVolume(&volume) == B_OK) { BDirectory root; BEntry entry; if (!volume.IsPersistent() || volume.GetRootDirectory(&root) != B_OK || root.GetEntry(&entry) != B_OK) continue; Model model(&entry); AddOneItem(&model); } }
void BSlowContextMenu::BuildVolumeMenu() { BVolumeRoster roster; BVolume volume; roster.Rewind(); while (roster.GetNextVolume(&volume) == B_OK) { if (!volume.IsPersistent()) continue; BDirectory startDir; if (volume.GetRootDirectory(&startDir) == B_OK) { BEntry entry; startDir.GetEntry(&entry); Model *model = new Model(&entry); if (model->InitCheck() != B_OK) { delete model; continue; } BNavMenu *menu = new BNavMenu(model->Name(), fMessage.what, fMessenger, fParentWindow, fTypesList); menu->SetNavDir(model->EntryRef()); menu->InitTrackingHook(fTrackingHook.fTrackingHook, &(fTrackingHook.fTarget), fTrackingHook.fDragMessage); ASSERT(menu->Name()); ModelMenuItem *item = new ModelMenuItem(model, menu); BMessage *message = new BMessage(fMessage); message->AddRef("refs", model->EntryRef()); item->SetMessage(message); fItemList->AddItem(item); ASSERT(item->Label()); } } }
status_t PackageView::_InstallTypeChanged(int32 index) { if (index < 0) return B_ERROR; // Clear the choice list for (int32 i = fDestination->CountItems() - 1; i >= 0; i--) { BMenuItem* item = fDestination->RemoveItem(i); delete item; } fCurrentType = index; pkg_profile* profile = fInfo.GetProfile(index); if (profile == NULL) return B_ERROR; BString typeDescription = profile->description; if (typeDescription.IsEmpty()) typeDescription = profile->name; fInstallTypeDescriptionView->SetText(typeDescription.String()); BPath path; BVolume volume; if (profile->path_type == P_INSTALL_PATH) { BMenuItem* item = NULL; if (find_directory(B_SYSTEM_NONPACKAGED_DIRECTORY, &path) == B_OK) { dev_t device = dev_for_path(path.Path()); if (volume.SetTo(device) == B_OK && !volume.IsReadOnly() && path.Append("apps") == B_OK) { item = _AddDestinationMenuItem(path.Path(), volume.FreeBytes(), path.Path()); } } if (item != NULL) { item->SetMarked(true); fCurrentPath.SetTo(path.Path()); fDestination->AddSeparatorItem(); } _AddMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS), new BMessage(P_MSG_OPEN_PANEL), fDestination); fDestField->SetEnabled(true); } else if (profile->path_type == P_USER_PATH) { bool defaultPathSet = false; BVolumeRoster roster; while (roster.GetNextVolume(&volume) != B_BAD_VALUE) { BDirectory mountPoint; if (volume.IsReadOnly() || !volume.IsPersistent() || volume.GetRootDirectory(&mountPoint) != B_OK) { continue; } if (path.SetTo(&mountPoint, NULL) != B_OK) continue; char volumeName[B_FILE_NAME_LENGTH]; volume.GetName(volumeName); BMenuItem* item = _AddDestinationMenuItem(volumeName, volume.FreeBytes(), path.Path()); // The first volume becomes the default element if (!defaultPathSet) { item->SetMarked(true); fCurrentPath.SetTo(path.Path()); defaultPathSet = true; } } fDestField->SetEnabled(true); } else fDestField->SetEnabled(false); return B_OK; }
filter_result TFilePanel::FSFilter(BMessage* message, BHandler**, BMessageFilter* filter) { if (message == NULL) return B_DISPATCH_MESSAGE; ASSERT(filter != NULL); if (filter == NULL) return B_DISPATCH_MESSAGE; TFilePanel* panel = dynamic_cast<TFilePanel*>(filter->Looper()); ASSERT(panel != NULL); if (panel == NULL) return B_DISPATCH_MESSAGE; switch (message->FindInt32("opcode")) { case B_ENTRY_MOVED: { node_ref itemNode; message->FindInt64("node", (int64*)&itemNode.node); node_ref dirNode; message->FindInt32("device", &dirNode.device); itemNode.device = dirNode.device; message->FindInt64("to directory", (int64*)&dirNode.node); const char* name; if (message->FindString("name", &name) != B_OK) break; // if current directory moved, update entry ref and menu // but not wind title if (*(panel->TargetModel()->NodeRef()) == itemNode) { panel->TargetModel()->UpdateEntryRef(&dirNode, name); panel->SetTo(panel->TargetModel()->EntryRef()); return B_SKIP_MESSAGE; } break; } case B_ENTRY_REMOVED: { node_ref itemNode; message->FindInt32("device", &itemNode.device); message->FindInt64("node", (int64*)&itemNode.node); // if folder we're watching is deleted, switch to root // or Desktop if (*(panel->TargetModel()->NodeRef()) == itemNode) { BVolumeRoster volumeRoster; BVolume volume; volumeRoster.GetBootVolume(&volume); BDirectory root; volume.GetRootDirectory(&root); BEntry entry; entry_ref ref; root.GetEntry(&entry); entry.GetRef(&ref); panel->SwitchDirToDesktopIfNeeded(ref); panel->SetTo(&ref); return B_SKIP_MESSAGE; } break; } } return B_DISPATCH_MESSAGE; }
TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target, const BEntry* startDir, uint32 nodeFlavors, bool multipleSelection, BMessage* message, BRefFilter* filter, uint32 containerWindowFlags, window_look look, window_feel feel, bool hideWhenDone) : BContainerWindow(0, containerWindowFlags, look, feel, 0, B_CURRENT_WORKSPACE), fDirMenu(NULL), fDirMenuField(NULL), fTextControl(NULL), fClientObject(NULL), fSelectionIterator(0), fMessage(NULL), fHideWhenDone(hideWhenDone), fIsTrackingMenu(false) { InitIconPreloader(); fIsSavePanel = (mode == B_SAVE_PANEL); BRect windRect(85, 50, 568, 296); MoveTo(windRect.LeftTop()); ResizeTo(windRect.Width(), windRect.Height()); fNodeFlavors = (nodeFlavors == 0) ? B_FILE_NODE : nodeFlavors; if (target) fTarget = *target; else fTarget = BMessenger(be_app); if (message) SetMessage(message); else if (fIsSavePanel) fMessage = new BMessage(B_SAVE_REQUESTED); else fMessage = new BMessage(B_REFS_RECEIVED); gLocalizedNamePreferred = BLocaleRoster::Default()->IsFilesystemTranslationPreferred(); // check for legal starting directory Model* model = new Model(); bool useRoot = true; if (startDir) { if (model->SetTo(startDir) == B_OK && model->IsDirectory()) useRoot = false; else { delete model; model = new Model(); } } if (useRoot) { BPath path; if (find_directory(B_USER_DIRECTORY, &path) == B_OK) { BEntry entry(path.Path(), true); if (entry.InitCheck() == B_OK && model->SetTo(&entry) == B_OK) useRoot = false; } } if (useRoot) { BVolume volume; BDirectory root; BVolumeRoster volumeRoster; volumeRoster.GetBootVolume(&volume); volume.GetRootDirectory(&root); BEntry entry; root.GetEntry(&entry); model->SetTo(&entry); } fTaskLoop = new PiggybackTaskLoop; AutoLock<BWindow> lock(this); CreatePoseView(model); fPoseView->SetRefFilter(filter); if (!fIsSavePanel) fPoseView->SetMultipleSelection(multipleSelection); fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE); fPoseView->SetPoseEditing(false); AddCommonFilter(new BMessageFilter(B_KEY_DOWN, key_down_filter)); AddCommonFilter(new BMessageFilter(B_SIMPLE_DATA, TFilePanel::MessageDropFilter)); AddCommonFilter(new BMessageFilter(B_NODE_MONITOR, TFilePanel::FSFilter)); // inter-application observing BMessenger tracker(kTrackerSignature); BHandler::StartWatching(tracker, kDesktopFilePanelRootChanged); Init(); }
status_t ExtractQueryVolumes(BNode *node, vollist *volumes) { int32 length = 0; char *attr = ReadAttribute(*node, kTrackerQueryVolume, &length); BVolumeRoster roster; if (attr == NULL) { roster.Rewind(); BVolume vol; while (roster.GetNextVolume(&vol) == B_NO_ERROR) { if ((vol.IsPersistent() == true) && (vol.KnowsQuery() == true)) { volumes->push_back(vol); }; }; } else { BMessage msg; msg.Unflatten(attr); // !*YOINK*!d from that project... with the funny little doggie as a logo... // OpenTracker, that's it! time_t created; off_t capacity; for (int32 index = 0; msg.FindInt32("creationDate", index, &created) == B_OK; index++) { if ((msg.FindInt32("creationDate", index, &created) != B_OK) || (msg.FindInt64("capacity", index, &capacity) != B_OK)) return B_ERROR; BVolume volume; BString deviceName = ""; BString volumeName = ""; BString fshName = ""; if (msg.FindString("deviceName", &deviceName) == B_OK && msg.FindString("volumeName", &volumeName) == B_OK && msg.FindString("fshName", &fshName) == B_OK) { // New style volume identifiers: We have a couple of characteristics, // and compute a score from them. The volume with the greatest score // (if over a certain threshold) is the one we're looking for. We // pick the first volume, in case there is more than one with the // same score. int foundScore = -1; roster.Rewind(); char name[B_FILE_NAME_LENGTH]; while (roster.GetNextVolume(&volume) == B_OK) { if (volume.IsPersistent() && volume.KnowsQuery()) { // get creation time and fs_info BDirectory root; volume.GetRootDirectory(&root); time_t cmpCreated; fs_info info; if (root.GetCreationTime(&cmpCreated) == B_OK && fs_stat_dev(volume.Device(), &info) == 0) { // compute the score int score = 0; // creation time if (created == cmpCreated) score += 5; // capacity if (capacity == volume.Capacity()) score += 4; // device name if (deviceName == info.device_name) score += 3; // volume name if (volumeName == info.volume_name) score += 2; // fsh name if (fshName == info.fsh_name) score += 1; // check score if (score >= 9 && score > foundScore) { volume.GetName(name); volumes->push_back(volume); } } } } } else { // Old style volume identifiers: We have only creation time and // capacity. Both must match. roster.Rewind(); while (roster.GetNextVolume(&volume) == B_OK) if (volume.IsPersistent() && volume.KnowsQuery()) { BDirectory root; volume.GetRootDirectory(&root); time_t cmpCreated; root.GetCreationTime(&cmpCreated); if (created == cmpCreated && capacity == volume.Capacity()) { volumes->push_back(volume); } } } }; }; return B_OK; };
int getmntent_haiku(int* cookie, struct mnttab* mp) { static BLocker mntent_locker; mntent_locker.Lock(); int ret = -1; BVolumeRoster roster; char buf[B_PATH_NAME_LENGTH]; int buflen = 0; BVolume volume; BDirectory rootDir; BEntry rootDirEntry; BPath rootDirPath; roster.Rewind(); for (int i = 0; i <= *cookie; i++) if (roster.GetNextVolume(&volume) != B_NO_ERROR) goto bail; // volume name volume.GetName(buf); buflen = strlen(buf); if (buflen == 0) { buflen = strlen(MNTENT_MP_UNKNOWN); strlcpy(buf, MNTENT_MP_UNKNOWN, buflen + 1); } mp->mnt_special = (char* )malloc(sizeof(char) * (buflen+1)); strlcpy(mp->mnt_special, buf, buflen+1); // mount point if (volume.GetRootDirectory(&rootDir) != B_OK || rootDir.GetEntry(&rootDirEntry) != B_OK || rootDirEntry.GetPath(&rootDirPath) != B_OK) goto bail; buflen = strlen(rootDirPath.Path()); mp->mnt_mountp = (char* )malloc(sizeof(char) * (buflen+1)); strlcpy(mp->mnt_mountp, rootDirPath.Path(), buflen + 1); // partition type. fs_info info; if (fs_stat_dev(volume.Device(), &info) != B_OK) goto bail; buflen = strlen(info.fsh_name); mp->mnt_fstype = (char* )malloc(sizeof(char) * (buflen+1)); strlcpy(mp->mnt_fstype, info.fsh_name, buflen+1); // fs options. set default options for all file systems for now. buflen = strlen(MNTENT_MP_DEFAULT_OPTS); mp->mnt_mntopts = (char* )malloc(sizeof(char) * (buflen+2+1)); // extra space for ro/rw strlcpy(mp->mnt_mntopts, MNTENT_MP_DEFAULT_OPTS, buflen + 2 + 1); strcat(mp->mnt_mntopts, volume.IsReadOnly() ? ",ro":",rw"); // mount time. no idea how i can get this. set it to 0 for now. buflen = 1; mp->mnt_time = (char* )malloc(sizeof(char) * (buflen+1)); strlcpy(mp->mnt_time, "0", buflen + 1); (*cookie)++; ret = 0; /* success! */ bail: mntent_locker.Unlock(); return ret; }
status_t BVolume::SetTo(e_dev_t dev) { #ifdef HAVE_MNTENT_H if (dev <= 0) { Unset(); } else if (fDevice != dev) { FILE *ent = setmntent("/etc/fstab", "r"); if (ent == NULL) { ETK_DEBUG("[STORAGE]: %s --- Unable to open /etc/fstab", __PRETTY_FUNCTION__); return B_ENTRY_NOT_FOUND; } struct mntent *mnt = NULL; for (e_dev_t i = 0; i < dev; i++) { if ((mnt = getmntent(ent)) == NULL) break; } if (mnt == NULL) { endmntent(ent); return B_ENTRY_NOT_FOUND; } if (fData == NULL) { if ((fData = new_dev_data()) == NULL) { endmntent(ent); return B_NO_MEMORY; } } status_t status = set_dev_data((e_dev_data_t*)fData, mnt->mnt_fsname, mnt->mnt_dir); endmntent(ent); if (status != B_OK) return status; fDevice = dev; } return B_OK; #else // !HAVE_MNTENT_H #ifdef _WIN32 if (dev <= 0) { Unset(); } else if (fDevice != dev) { if (dev > 26) return B_ENTRY_NOT_FOUND; DWORD driveMask = GetLogicalDrives(); if (driveMask == 0) return B_ENTRY_NOT_FOUND; if (!(driveMask & (1UL << (dev - 1)))) return B_BAD_VALUE; if (fData == NULL) { if ((fData = new_dev_data()) == NULL) return B_NO_MEMORY; } char dirname[4] = "A:\\"; *dirname += (dev - 1); BString nameStr; char nameBuf[301]; bzero(nameBuf, 301); if (!(GetVolumeInformation(dirname, nameBuf, 300, NULL, NULL, NULL, NULL, 0) == 0 || nameBuf[0] == 0)) { WCHAR wStr[301]; bzero(wStr, sizeof(WCHAR) * 301); MultiByteToWideChar(CP_ACP, 0, nameBuf, -1, wStr, 300); char *utf8Name = e_unicode_convert_to_utf8((const unichar*)wStr, -1); if (utf8Name != NULL) { nameStr.SetTo(utf8Name); free(utf8Name); } } if (nameStr.Length() <= 0) nameStr.SetTo(nameBuf); dirname[2] = '/'; status_t status = set_dev_data((e_dev_data_t*)fData, nameStr.String(), dirname); if (status != B_OK) return status; fDevice = dev; } return B_OK; #else // !_WIN32 #ifdef __BEOS__ if (dev <= 0) { Unset(); } else if (fDevice != dev) { if (fData == NULL) if ((fData = new_dev_data()) == NULL) return B_NO_MEMORY; BVolume vol; BVolumeRoster volRoster; BDirectory beDir; BEntry beEntry; BPath bePath; char volName[B_FILE_NAME_LENGTH + 1]; bzero(volName, B_FILE_NAME_LENGTH + 1); e_dev_t tmp = dev; while (tmp > 0) { if (volRoster.GetNextVolume(&vol) != B_OK) return B_ENTRY_NOT_FOUND; if (--tmp > 0) continue; if (vol.GetRootDirectory(&beDir) != B_OK || beDir.GetEntry(&beEntry) != B_OK || beEntry.GetPath(&bePath) != B_OK) return B_ENTRY_NOT_FOUND; vol.GetName(volName); } status_t status = set_dev_data((e_dev_data_t*)fData, volName, bePath.Path()); if (status != B_OK) return status; fDevice = dev; } return B_OK; #else // !__BEOS__ #warning "fixme: BVolume::SetTo" if (dev <= 0) { Unset(); return B_OK; } else if (fDevice != dev && dev == 1) { if (fData == NULL) if ((fData = new_dev_data()) == NULL) return B_NO_MEMORY; status_t status = set_dev_data((e_dev_data_t*)fData, "root", "/"); if (status != B_OK) return status; fDevice = dev; return B_OK; } return B_ENTRY_NOT_FOUND; #endif // __BEOS__ #endif // _WIN32 #endif // HAVE_MNTENT_H }
bool FolderShaper::IsFolderUntouchable(uint32 purpose, const entry_ref * a_ref) { // system directories if (IsItThisFolder(a_ref, B_DESKTOP_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_TRASH_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_APPS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_PREFERENCES_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_SYSTEM_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_ADDONS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_BOOT_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_FONTS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_LIB_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_SERVERS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_APPS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_BIN_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_ETC_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_DOCUMENTATION_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_BEOS_PREFERENCES_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_ADDONS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_BOOT_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_FONTS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_LIB_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_SERVERS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_BIN_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_ETC_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_DOCUMENTATION_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_SETTINGS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_DEVELOP_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_LOG_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_SPOOL_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_TEMP_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_SYSTEM_VAR_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_CONFIG_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_ADDONS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_BOOT_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_FONTS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_LIB_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_SETTINGS_DIRECTORY)) return SysDirMessage(a_ref); if (IsItThisFolder(a_ref, B_USER_DESKBAR_DIRECTORY)) return SysDirMessage(a_ref); // volume roots BVolumeRoster vol_roster; BVolume volume; BDirectory vol_dir; BEntry vol_entry; entry_ref vol_ref; while (vol_roster.GetNextVolume(& volume) == B_OK) { volume.GetRootDirectory(& vol_dir); vol_dir.GetEntry(& vol_entry); vol_entry.GetRef(& vol_ref); if (*a_ref == vol_ref) return VolRootMessage(a_ref); } // target does not support attributes if (volume.SetTo(a_ref->device) != B_OK) { // message return true; } if(! volume.KnowsAttr()) { char volname[B_FILE_NAME_LENGTH]; volume.GetName(volname); return NoAttributesMessage(purpose, a_ref, volname); } // and perhaps returns something for the BAlert return false; }