示例#1
0
// create_app
static
entry_ref
create_app(const char *filename, const char *signature,
		   bool install = false, bool makeExecutable = true,
		   uint32 appFlags = B_SINGLE_LAUNCH)
{
	BString testApp;
	CHK(find_test_app("RosterBroadcastTestApp1", &testApp) == B_OK);
	system((string("cp ") + testApp.String() + " " + filename).c_str());
	if (makeExecutable)
		system((string("chmod a+x ") + filename).c_str());
	BFile file;
	CHK(file.SetTo(filename, B_READ_WRITE) == B_OK);
	BAppFileInfo appFileInfo;
	CHK(appFileInfo.SetTo(&file) == B_OK);
	if (signature)
		CHK(appFileInfo.SetSignature(signature) == B_OK);
	CHK(appFileInfo.SetAppFlags(appFlags) == B_OK);
	if (install && signature)
		CHK(BMimeType(signature).Install() == B_OK);
	// We write the signature into a separate attribute, just in case we
	// decide to also test files without BEOS:APP_SIG attribute.
	BString signatureString(signature);
	file.WriteAttrString("signature", &signatureString);
	return ref_for_path(filename);
}
示例#2
0
bool BeAIMApplication::SetDeskbarVisibility( bool vis )
{
	app_info appInfo;
	BFile file;
	BAppFileInfo appFileInfo;
	uint32 appFlags;

	// get the BAppFileInfo object for this application
	be_app->GetAppInfo(&appInfo);
	file.SetTo(&appInfo.ref, B_READ_WRITE);
	appFileInfo.SetTo(&file);

	// get the app flags
	appFileInfo.GetAppFlags(&appFlags);

	// make the app visible (or not) in the deskbar
	if( vis )
		appFlags &= ~B_BACKGROUND_APP;
	else
		appFlags |= B_BACKGROUND_APP;

	// now set them!
	appFileInfo.SetAppFlags(appFlags);
}