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


C++ BEntry::GetPath方法代码示例

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


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

示例1: dir

status_t
ACPIDriverInterface::_FindDrivers(const char* path)
{
	BDirectory dir(path);
	BEntry entry;

	status_t status = B_ERROR;

	while (dir.GetNextEntry(&entry) == B_OK) {
		BPath path;
		entry.GetPath(&path);

		if (entry.IsDirectory()) {
			if (_FindDrivers(path.Path()) == B_OK)
				return B_OK;
		}
		else {
			int32 handler = open(path.Path(), O_RDWR);
			if (handler >= 0) {
				printf("try %s\n", path.Path());
				Battery* battery = new Battery(handler);
				if (battery->InitCheck() == B_OK) {
					fDriverList.AddItem(battery);
					status = B_OK;
				}
				else
					delete battery;
			}
		}

	}
	return status;
}
开发者ID:mmanley,项目名称:Antares,代码行数:33,代码来源:ACPIDriverInterface.cpp

示例2:

void
PoorManPreferencesWindow::SelectWebDir(BMessage* message)
{
	entry_ref	ref;
	BPath		path;
	BEntry		entry;

	if (message->FindRef("refs", &ref) != B_OK || entry.SetTo(&ref) != B_OK) {
		return;
	}
	entry.GetPath(&path);

	PRINT(("DIR: %s\n", path.Path()));
	fSiteView->SetWebDir(path.Path());
	
	bool temp;
	if (message->FindBool("Default Dialog", &temp) == B_OK) {
		PoorManWindow* win = ((PoorManApplication *)be_app)->GetPoorManWindow();
		win->StartServer();
		if (win->GetServer()->SetWebDir(fSiteView->WebDir()) == B_OK) {
			win->SetWebDir(fSiteView->WebDir());
			win->SetDirLabel(fSiteView->WebDir());
			win->SaveSettings();
			win->Show();		
		}
		if (Lock())
			Quit();
	}
}
开发者ID:DonCN,项目名称:haiku,代码行数:29,代码来源:PoorManPreferencesWindow.cpp

示例3: BString

void
LiveQuery::_PerformQuery(BQuery& query)
{
	status_t status = query.Fetch();
	if (status != B_OK) {
		fprintf(stderr, "%s: bad query expression\n", kProgramName);
		return;
	}

	int32 count = 0;

	BEntry entry;
	BPath path;
	while (query.GetNextEntry(&entry) == B_OK) {
		if (sFilesOnly && !entry.IsFile())
			continue;

		if (entry.GetPath(&path) != B_OK) {
			fprintf(stderr, "%s: could not get path for entry\n", kProgramName);
			continue;
		}

		printf("%s\n", sEscapeMetaChars ? BString().CharacterEscape(
				path.Path(), " ()?*&\"'[]^\\~|;!<>*$\t", '\\').String()
			: path.Path());

		count++;
	}

	printf("FOUND %ld entries\n", count);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:31,代码来源:live_query.cpp

示例4: package

void
App::_Open(const BEntry& entry)
{
	BPath path;
	if (!entry.Exists() || !entry.GetPath(&path) == B_OK) {
		fprintf(stderr, "Package file not found: %s\n", path.Path());
		return;
	}

	// Try to parse package file via Package Kit
	BPackageKit::BPackageInfo info;
	status_t status = info.ReadFromPackageFile(path.Path());
	if (status != B_OK) {
		fprintf(stderr, "Failed to parse package file: %s\n",
			strerror(status));
		return;
	}

	// Transfer information into PackageInfo
	PackageInfoRef package(new(std::nothrow) PackageInfo(info), true);
	if (package.Get() == NULL) {
		fprintf(stderr, "Could not allocate PackageInfo\n");
		return;
	}

	package->SetLocalFilePath(path.Path());

	BMessage settings;
	_LoadSettings(settings);

	MainWindow* window = new MainWindow(_GetNextWindowFrame(true), settings,
		package);
	_ShowWindow(window);
}
开发者ID:kodybrown,项目名称:haiku,代码行数:34,代码来源:App.cpp

示例5: if

void
ModuleManager::_FindModules(BDirectory &dir, const char *moduleDir,
	const char *suffix, module_name_list *list)
{
	BEntry entry;
	while (dir.GetNextEntry(&entry) == B_OK) {
		if (entry.IsFile()) {
			ModuleAddOn addon;
			BPath path;
			if (entry.GetPath(&path) == B_OK
				&& addon.Load(path.Path(), moduleDir) == B_OK) {
				module_info **infos = addon.ModuleInfos();
				for (int32 i = 0; infos[i]; i++) {
					if (infos[i]->name
						&& _MatchSuffix(infos[i]->name, suffix))
						list->names.insert(infos[i]->name);
				}
			}
		} else if (entry.IsDirectory()) {
			BDirectory subdir;
			if (subdir.SetTo(&entry) == B_OK)
				_FindModules(subdir, moduleDir, suffix, list);
		}
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:25,代码来源:module.cpp

示例6: 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

示例7: BMessage

void
OpenWindow::CollectDevices(BMenu *menu, BEntry *startEntry)
{
	BDirectory directory;
	if (startEntry != NULL)
		directory.SetTo(startEntry);
	else
		directory.SetTo("/dev/disk");

	BEntry entry;
	while (directory.GetNextEntry(&entry) == B_OK) {
		if (entry.IsDirectory()) {
			CollectDevices(menu, &entry);
			continue;
		}

		entry_ref ref;
		if (entry.GetRef(&ref) != B_OK)
			continue;

		BPath path;
		if (entry.GetPath(&path) != B_OK)
			continue;

		BMessage *message = new BMessage(B_REFS_RECEIVED);
		message->AddRef("refs", &ref);

		menu->AddItem(new BMenuItem(path.Path(), message));
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:30,代码来源:OpenWindow.cpp

示例8:

void 
ScreenSaverApp::RefsReceived(BMessage *message)
{
	entry_ref ref;
	if (message->FindRef("refs", &ref) != B_OK)
		return;

	// Install the screen saver by copying it to the add-ons directory
	// TODO: the translator have a similar mechanism - this could be cleaned
	//	up and have one nicely working solution
	// TODO: should test if the dropped ref is really a screen saver!
	// TODO: you can receive more than one ref at a time...

	BEntry entry;
	entry.SetTo(&ref, true);
	if (entry.InitCheck() != B_OK)
		return;

	BPath path;
	entry.GetPath(&path);

	// TODO: find_directory() anyone??
	char temp[2*B_PATH_NAME_LENGTH];
	sprintf(temp,"cp %s '/boot/home/config/add-ons/Screen Savers/'\n", path.Path());
	system(temp);
	fScreenSaverWindow->PostMessage(kMsgUpdateList);
}
开发者ID:mariuz,项目名称:haiku,代码行数:27,代码来源:ScreenSaverApp.cpp

示例9: if

//---------------------- Private ---------------------------------//
status_t
JoyWin::_AddToList(BListView *list, uint32 command,
	const char* rootPath, BEntry *rootEntry = NULL)
{
	BDirectory root;

	if ( rootEntry != NULL )
		root.SetTo( rootEntry );
	else if ( rootPath != NULL )
		root.SetTo( rootPath );
	else
		return B_ERROR;

	BEntry entry;
	while ((root.GetNextEntry(&entry)) > B_ERROR ) {
		if (entry.IsDirectory()) {
			_AddToList(list, command, rootPath, &entry);
		} else {
			BPath path;
			entry.GetPath(&path);
			BString str(path.Path());
			str.RemoveFirst(rootPath);
			list->AddItem(new PortItem(str.String()));
		}
	}
	return B_OK;
}
开发者ID:mariuz,项目名称:haiku,代码行数:28,代码来源:JoyWin.cpp

示例10: dir

off_t
BackupView::DirectorySize(BPath* path, bool recurse)
{
	off_t bytes = 0;
	if (!path) {
		printf("Error: Invalid path passed!\n");
		return bytes;
	}
	//printf("%s: %s\n", __func__, path->Path());
	BDirectory dir(path->Path());
	int32 entries = dir.CountEntries();
	//printf("%s: items: %" B_PRId32 "\n", __func__, entries);
	dir.Rewind();
	for (int32 i = 0; i < entries; i++) {
		BEntry entry;
		dir.GetNextEntry(&entry);
		struct stat st;
		entry.GetStat(&st);
		if (S_ISDIR(st.st_mode) && recurse == true) {
			BPath nextPath;
			entry.GetPath(&nextPath);
			bytes += DirectorySize(&nextPath);
		} else {
			bytes += st.st_size;
		}
	}
	return bytes;
}
开发者ID:kallisti5,项目名称:backup,代码行数:28,代码来源:BackupView.cpp

示例11: tryDir

/*
 * This function is lifted from Simple Directmedia Layer (SDL):
 *  http://www.libsdl.org/
 */
static void tryDir(const char *d, PHYSFS_StringCallback callback, void *data)
{
    BDirectory dir;
    dir.SetTo(d);
    if (dir.InitCheck() != B_NO_ERROR)
        return;

    dir.Rewind();
    BEntry entry;
    while (dir.GetNextEntry(&entry) >= 0)
    {
        BPath path;
        const char *name;
        entry_ref e;

        if (entry.GetPath(&path) != B_NO_ERROR)
            continue;

        name = path.Path();

        if (entry.GetRef(&e) != B_NO_ERROR)
            continue;

        if (entry.IsDirectory())
        {
            if (strcmp(e.name, "floppy") != 0)
                tryDir(name, callback, data);
        } /* if */

        else
        {
            bool add_it = false;
            int devfd;
            device_geometry g;

            if (strcmp(e.name, "raw") == 0)  /* ignore partitions. */
            {
                int devfd = open(name, O_RDONLY);
                if (devfd >= 0)
                {
                    if (ioctl(devfd, B_GET_GEOMETRY, &g, sizeof(g)) >= 0)
                    {
                        if (g.device_type == B_CD)
                        {
                            char *mntpnt = getMountPoint(name);
                            if (mntpnt != NULL)
                            {
                                callback(data, mntpnt);
                                allocator.Free(mntpnt);  /* !!! FIXME: lose this malloc! */
                            } /* if */
                        } /* if */
                    } /* if */
                } /* if */
            } /* if */

            close(devfd);
        } /* else */
    } /* while */
} /* tryDir */
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:63,代码来源:beos.cpp

示例12: strncmp

bool
PathHandler::_CloserToPath(BEntry& entry) const
{
	BPath path;
	if (entry.GetPath(&path) != B_OK)
		return false;

	return strncmp(path.Path(), fPath.Path(), strlen(path.Path())) == 0;
}
开发者ID:mmanley,项目名称:Antares,代码行数:9,代码来源:PathMonitor.cpp

示例13:

void
MediaConverterWindow::_SetOutputFolder(BEntry entry)
{
	BPath path;
	entry.GetPath(&path);
	fOutputFolder->SetText(path.Path());
	fOutputFolder->ResizeToPreferred();
	fOutputDir.SetTo(path.Path());
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:9,代码来源:MediaConverterWindow.cpp

示例14: dir

int32
CDAudioDevice::_FindDrives(const char *path)
{
	BDirectory dir(path);

	if (dir.InitCheck() != B_OK)
		return B_ERROR; 

	dir.Rewind();

	BEntry entry; 
	while (dir.GetNextEntry(&entry) >= 0) {
		BPath path;
		const char *name;
		entry_ref e;

		if (entry.GetPath(&path) != B_OK)
			continue;

		name = path.Path();
		if (entry.GetRef(&e) != B_OK)
			continue;

		if (entry.IsDirectory()) {
			// ignore floppy -- it is not silent
			if (strcmp(e.name, "floppy") == 0)
				continue;
			else if (strcmp(e.name, "ata") == 0)
				continue;

			// Note that if we check for the count here, we could
			// just search for one drive. However, we want to find *all* drives
			// that are available, so we keep searching even if we've found one
			_FindDrives(name);

		} else {
			int devfd;
			device_geometry g;

			// ignore partitions
			if (strcmp(e.name, "raw") != 0)
				continue;

			devfd = open(name, O_RDONLY);
			if (devfd < 0)
				continue;

			if (ioctl(devfd, B_GET_GEOMETRY, &g, sizeof(g)) >= 0) {
				if (g.device_type == B_CD)
					fDriveList.AddItem(new BString(name));
			}
			close(devfd);
		}
	}
	return fDriveList.CountItems();
}
开发者ID:mmanley,项目名称:Antares,代码行数:56,代码来源:CDAudioDevice.cpp

示例15: 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


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