当前位置: 首页>>代码示例>>C++>>正文


C++ BDirectory::GetEntry方法代码示例

本文整理汇总了C++中BDirectory::GetEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ BDirectory::GetEntry方法的具体用法?C++ BDirectory::GetEntry怎么用?C++ BDirectory::GetEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BDirectory的用法示例。


在下文中一共展示了BDirectory::GetEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: target

void
PersonWindow::SaveAs()
{
	char name[B_FILE_NAME_LENGTH];
	_GetDefaultFileName(name);

	if (fPanel == NULL) {
		BMessenger target(this);
		fPanel = new BFilePanel(B_SAVE_PANEL, &target);

		BPath path;
		find_directory(B_USER_DIRECTORY, &path, true);

		BDirectory dir;
		dir.SetTo(path.Path());

		BEntry entry;
		if (dir.FindEntry("people", &entry) == B_OK
			|| (dir.CreateDirectory("people", &dir) == B_OK
					&& dir.GetEntry(&entry) == B_OK)) {
			fPanel->SetPanelDirectory(&entry);
		}
	}

	if (fPanel->Window()->Lock()) {
		fPanel->SetSaveText(name);
		if (fPanel->Window()->IsHidden())
			fPanel->Window()->Show();
		else
			fPanel->Window()->Activate();
		fPanel->Window()->Unlock();
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:33,代码来源:PersonWindow.cpp

示例2: is_drive_mounted

static bool is_drive_mounted(const char *dev_name, char *mount_name)
{
	int32 i = 0;
	dev_t d;
	fs_info info;
	while ((d = next_dev(&i)) >= 0) {
		fs_stat_dev(d, &info);
		if (strcmp(dev_name, info.device_name) == 0) {
			status_t err = -1;
			BPath mount;
			BDirectory dir;
			BEntry entry;
			node_ref node;
			node.device = info.dev;
			node.node = info.root;
			err = dir.SetTo(&node);
			if (!err)
				err = dir.GetEntry(&entry);
			if (!err)
				err = entry.GetPath(&mount);
			if (!err) {
				strcpy(mount_name, mount.Path());
				return true;
			}
		}
	}
	return false;
}
开发者ID:AlexandreCo,项目名称:macemu,代码行数:28,代码来源:sys_beos.cpp

示例3: GetDirectorySize

uint64 PanelView::GetDirectorySize(const char *path)
////////////////////////////////////////////////////////////////////////
{
	uint64 size = 0;
	BDirectory *dir;
		
	dir = new BDirectory(path);
	if (dir)
	{
		BEntry entry;
		
		if (dir->GetEntry(&entry)==B_OK)
		{	
			while (dir->GetNextEntry(&entry)==B_OK)			
			{
				BPath path;
				entry.GetPath(&path);
				
				if (entry.IsDirectory())
					size += GetDirectorySize(path.Path());
				else
				{
					struct stat statbuf;
					entry.GetStat(&statbuf);
					
					size += statbuf.st_size;
				}	
			}
		}
	
		delete dir;
	}

	return size;
}
开发者ID:PZsolt27,项目名称:GenesisCommander,代码行数:35,代码来源:GenesisPanelView.cpp

示例4: while

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 */
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:34,代码来源:beos.cpp

示例5: while

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 */
开发者ID:Alexander-r,项目名称:physfs,代码行数:31,代码来源:physfs_platform_haiku.cpp

示例6: ReadDisks

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);
}
开发者ID:PZsolt27,项目名称:GenesisCommander,代码行数:56,代码来源:GenesisPanelView.cpp

示例7: InitCheck

status_t
BPrinter::SetTo(const BDirectory& directory)
{
	StopWatching();

	BEntry entry;
	directory.GetEntry(&entry);
	entry.GetRef(&fPrinterEntryRef);

	return InitCheck();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:11,代码来源:Printer.cpp

示例8: GetInstallationLocationInfo

status_t
BDaemonClient::CreateTransaction(BPackageInstallationLocation location,
	BActivationTransaction& _transaction, BDirectory& _transactionDirectory)
{
	// get an info for the location
	BInstallationLocationInfo info;
	status_t error = GetInstallationLocationInfo(location, info);
	if (error != B_OK)
		return error;

	// open admin directory
	entry_ref entryRef;
	entryRef.device = info.PackagesDirectoryRef().device;
	entryRef.directory = info.PackagesDirectoryRef().node;
	error = entryRef.set_name(PACKAGES_DIRECTORY_ADMIN_DIRECTORY);
	if (error != B_OK)
		return error;
	
	BDirectory adminDirectory;
	error = adminDirectory.SetTo(&entryRef);
	if (error != B_OK)
		return error;

	// create a transaction directory
	int uniqueId = 1;
	BString directoryName;
	for (;; uniqueId++) {
		directoryName.SetToFormat("transaction-%d", uniqueId);
		if (directoryName.IsEmpty())
			return B_NO_MEMORY;

		error = adminDirectory.CreateDirectory(directoryName,
			&_transactionDirectory);
		if (error == B_OK)
			break;
		if (error != B_FILE_EXISTS)
			return error;
	}

	// init the transaction
	error = _transaction.SetTo(location, info.ChangeCount(), directoryName);
	if (error != B_OK) {
		BEntry entry;
		_transactionDirectory.GetEntry(&entry);
		_transactionDirectory.Unset();
		if (entry.InitCheck() == B_OK)
			entry.Remove();
		return error;
	}

	return B_OK;
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:52,代码来源:DaemonClient.cpp

示例9: SysAddDiskPrefs

void SysAddDiskPrefs(void)
{
	// Let BeOS scan for HFS drives
	D(bug("Looking for Mac volumes...\n"));
	system("mountvolume -allhfs");

	// Add all HFS volumes
	int32 i = 0;
	dev_t d;
	fs_info info;
	while ((d = next_dev(&i)) >= 0) {
		fs_stat_dev(d, &info);
		status_t err = -1;
		BPath mount;
		if (!strcmp(info.fsh_name, "hfs")) {
			BDirectory dir;
			BEntry entry;
			node_ref node;
			node.device = info.dev;
			node.node = info.root;
			err = dir.SetTo(&node);
			if (!err)
				err = dir.GetEntry(&entry);
			if (!err)
				err = entry.GetPath(&mount);
		}
#warning TODO: unmount inuse disk!
#if 0
		if (!err)
			err = unmount(mount.Path());
#endif
		if (!err) {
			char dev_name[B_FILE_NAME_LENGTH];
			if (info.flags & B_FS_IS_READONLY) {
				dev_name[0] = '*';
				dev_name[1] = 0;
			} else
				dev_name[0] = 0;
			strcat(dev_name, info.device_name);
			PrefsAddString("disk", dev_name);
		}
	}
}
开发者ID:Na1w,项目名称:sheepshear,代码行数:43,代码来源:sys_beos.cpp

示例10: DeleteDirectory

void PanelView::DeleteDirectory(const char *dirname)
////////////////////////////////////////////////////////////////////////
{
	BDirectory *dir;
	key_info keyinfo;
	
	// Don't delete the parent directory!!!!!!
	if (strlen(dirname)>=3)
	{
		int len = strlen(dirname);
		if (dirname[len-1]=='.' && dirname[len-2]=='.' && dirname[len-3]=='/') return;
	}
		
	dir = new BDirectory(dirname);
	if (dir)
	{
		BEntry entry;
		
		if (dir->GetEntry(&entry)==B_OK)
		{	
			while (dir->GetNextEntry(&entry)==B_OK)			
			{
				get_key_info(&keyinfo);
				if (keyinfo.key_states[0] & 0x40)	// ESC
				{
					beep();
					delete dir;
					return;
				}

				BPath path;
				entry.GetPath(&path);
				
				if (entry.IsDirectory())
					DeleteDirectory(path.Path());

				entry.Remove();
			}
		}
	
		delete dir;
	}
}
开发者ID:PZsolt27,项目名称:GenesisCommander,代码行数:43,代码来源:GenesisPanelView.cpp

示例11: model

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);
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:19,代码来源:SlowContextPopup.cpp

示例12: 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());
		}
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:42,代码来源:SlowContextPopup.cpp

示例13:

int32_t
PDirectoryCreateDirectory(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;
	
	PDirectory *parent = static_cast<PDirectory*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BDirectory *backend = (BDirectory*)parent->GetBackend();
	
	PArgs *args = static_cast<PArgs*>(in), *outArgs = static_cast<PArgs*>(out);
	
	BString path;
	if (args->FindString("path", &path) != B_OK)
		return B_ERROR;
	
	BDirectory newDir;
	status_t status = backend->CreateDirectory(path.String(), &newDir);
	
	outArgs->MakeEmpty();
	
	if (status == B_OK)
	{
		BEntry entry;
		status = newDir.GetEntry(&entry);
		if (status == B_OK)
		{
			BPath dirPath;
			status = entry.GetPath(&dirPath);
			outArgs->AddString("path", dirPath.Path());
		}
	}
	
	outArgs->AddInt32("status", status);
	
	return B_OK;
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:39,代码来源:PDirectory.cpp

示例14: target

void
PersonWindow::SaveAs(int32 format)
{
	if (format == 0)
		format = B_PERSON_FORMAT;

	char name[B_FILE_NAME_LENGTH];
	_GetDefaultFileName(name);

	if (fPanel == NULL) {
		BPath path;
		BMessenger target(this);
		BMessage msg(B_SAVE_REQUESTED);
		msg.AddInt32("format", format);
		fPanel = new BFilePanel(B_SAVE_PANEL, &target, NULL, 0, true, &msg);
		

		find_directory(B_USER_DIRECTORY, &path, true);

		BDirectory dir;
		dir.SetTo(path.Path());

		BEntry entry;
		if (dir.FindEntry("people", &entry) == B_OK
			|| (dir.CreateDirectory("people", &dir) == B_OK
					&& dir.GetEntry(&entry) == B_OK)) {
			fPanel->SetPanelDirectory(&entry);
		}
	}

	if (fPanel->Window()->Lock()) {
		fPanel->SetSaveText(name);
		if (fPanel->Window()->IsHidden())
			fPanel->Window()->Show();
		else
			fPanel->Window()->Activate();
		fPanel->Window()->Unlock();
	}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:39,代码来源:PersonWindow.cpp

示例15: MessageReceived


//.........这里部分代码省略.........

			case msg_About:
			{
				AboutWindow *abwin = new AboutWindow();
				abwin->Show();
				break;
			}
			
			case msg_IdeBringToFront:
				PDoc::IDEBringToFront();
				break;

			case msg_IdeProjectToGroup:
				PDoc::IDEProject2Group();
				break;

			case msg_FindDifferences:
			{
				BRect r(100,100,500,250);
				new CDiffWindow(r, "Differences");
				break;
			}

			case msg_Open:
			{
				if (fOpenPanel->IsShowing())
				{
					fOpenPanel->Window()->SetWorkspaces(1 << current_workspace());
					fOpenPanel->Window()->Activate();
				}
				else
				{
					BEntry entry;
					gCWD.GetEntry(&entry);

					BAutolock lock(fOpenPanel->Window());

					entry_ref ref;
					entry.GetRef(&ref);
					fOpenPanel->SetPanelDirectory(&ref);
					fOpenPanel->Window()->SetWorkspaces(1 << current_workspace());

					if (gPrefs->GetPrefInt(prf_I_ZoomOpenPanel, 0))
					{
						BRect r = BScreen().Frame();

						fOpenPanel->Window()->MoveTo(r.left + 80, r.top + 40);
						fOpenPanel->Window()->ResizeTo(480, r.Height() - 50);
					}

					fOpenPanel->Show();
				}
				break;
			}

			case msg_CommandLineOpen:
			{
				entry_ref doc;
				FailOSErr (msg->FindRef("refs", &doc));

				CDocWindow *w;
				BEntry e;

				if (e.SetTo(&doc) == B_OK && e.Exists())
					w = dynamic_cast<CDocWindow*>(OpenWindow(doc));
				else
开发者ID:jscipione,项目名称:Paladin,代码行数:67,代码来源:PApp.cpp


注:本文中的BDirectory::GetEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。