Пример #1
0
void
VolumeObserverHandler::MessageReceived(BMessage* message)
{
	if (message->what != B_NODE_MONITOR)
		return;

	dev_t device;
	int32 opcode;
	message->FindInt32("opcode", &opcode) ;
	switch (opcode) {
		case B_DEVICE_MOUNTED :
			message->FindInt32("new device", &device);
			fIndexServer->AddVolume(BVolume(device));
			break ;
		
		case B_DEVICE_UNMOUNTED :
			message->FindInt32("device", &device);
			fIndexServer->RemoveVolume(BVolume(device));
			break ;
	}
}
Пример #2
0
bool
WidgetAttributeText::IsEditable() const
{
	return fColumn->Editable()
		&& !BVolume(fModel->StatBuf()->st_dev).IsReadOnly();
}
Пример #3
0
status_t
Project::Load(const char *path)
{
	BEntry entry(path,true);
	status_t status = entry.InitCheck();
	if (status != B_OK)
		return status;
	
	entry_ref ref;
	entry.GetRef(&ref);
	
	fReadOnly = BVolume(ref.device).IsReadOnly();
	
	TextFile file(ref,B_READ_ONLY);
	status = file.InitCheck();
	if (status != B_OK)
		return status;
	
	fGroupList.MakeEmpty();
	
	fPath = path;
	fName = fPath.GetBaseName();
	
	platform_t actualPlatform = DetectPlatform();
	
	STRACE(2,("Loading project %s\n",path));
	
	// Set this to an out-of-bounds value to detect if
	// there is no SCM entry in the project
	fSCMType = SCM_INIT;
	
	SourceGroup *srcgroup = NULL;
	SourceFile *srcfile = NULL;
	BString line = file.ReadLine();
	while (line.CountChars() > 0)
	{
		int32 pos = line.FindFirst("=");
		if (pos < 0)
		{
			line = file.ReadLine();
			continue;
		}
		
		BString entry = line;
		entry.Truncate(pos);
		
		BString value = line.String() + pos + 1;
		
		STRACE(2,("Load Project: %s=%s\n",entry.String(),value.String()));
		
		if (value.CountChars() > 0)
		{
			if (entry[0] == '#')
				continue;
			else
			if (entry == "SOURCEFILE")
			{
				if (value.String()[0] != '/')
				{
					value.Prepend("/");
					value.Prepend(fPath.GetFolder());
				}
				srcfile = gFileFactory.CreateSourceFileItem(value.String());
				AddFile(srcfile, srcgroup);
			}
			else if (entry == "DEPENDENCY")
			{
				if (srcfile)
					srcfile->fDependencies = value;
			}
			else if (entry == "LOCALINCLUDE")
			{
				ProjectPath include(fPath.GetFolder(), value.String());
				AddLocalInclude(include.Absolute().String());
			}
			else if (entry == "SYSTEMINCLUDE")
				AddSystemInclude(value.String());
			else if (entry == "LIBRARY")
			{
				if (actualPlatform == fPlatform)
					AddLibrary(value.String());
				else
					ImportLibrary(value.String(),actualPlatform);
			}
			else if (entry == "GROUP")
				srcgroup = AddGroup(value.String());
			else if (entry == "EXPANDGROUP")
			{
				if (srcgroup)
					srcgroup->expanded = value == "yes" ? true : false;
			}
			else if (entry == "TARGETNAME")
				fTargetName = value;
			else if (entry == "CCDEBUG")
				fDebug = value == "yes" ? true : false;
			else if (entry == "CCPROFILE")
				fProfile = value == "yes" ? true : false;
			else if (entry == "CCOPSIZE")
				fOpSize = value == "yes" ? true : false;
			else if (entry == "CCOPLEVEL")
				fOpLevel = atoi(value.String());
			else if (entry == "CCTARGETTYPE")
				fTargetType = atoi(value.String());
			else if (entry == "CCEXTRA")
				fExtraCompilerOptions = value;
			else if (entry == "LDEXTRA")
				fExtraLinkerOptions = value;
			else if (entry == "RUNARGS")
				fRunArgs = value;
			else if (entry == "SCM")
			{
				if (value.ICompare("hg") == 0)
					fSCMType = SCM_HG;
				else if (value.ICompare("git") == 0)
					fSCMType = SCM_GIT;
				else if (value.ICompare("svn") == 0)
					fSCMType = SCM_SVN;
				else
					fSCMType = SCM_NONE;
			}
			else if (entry == "PLATFORM")
			{
				if (value.ICompare("Haiku") == 0)
					fPlatform = PLATFORM_HAIKU;
				else if (value.ICompare("HaikuGCC4") == 0)
					fPlatform = PLATFORM_HAIKU_GCC4;
				else if (value.ICompare("Zeta") == 0)
					fPlatform = PLATFORM_ZETA;
				else
					fPlatform = PLATFORM_R5;
			}
				
		}
		
		line = file.ReadLine();
	}
	
	// Fix one of my pet peeves when changing platforms: having to add libsupc++.so whenever
	// I change to Haiku GCC4 or GCC4hybrid from any other platform
	if (actualPlatform == PLATFORM_HAIKU_GCC4 && actualPlatform != fPlatform)
	{
		BPath libpath;
		find_directory(B_USER_DEVELOP_DIRECTORY,&libpath);
		libpath.Append("lib/x86/libsupc++.so");
		AddLibrary(libpath.Path());
	}
	
	fObjectPath = fPath.GetFolder();
	
	BString objfolder("(Objects.");
	objfolder << GetName() << ")";
	fObjectPath.Append(objfolder.String());
	
	UpdateBuildInfo();
	
	// We now set the platform to whatever we're building on. fPlatform is only used
	// in the project loading code to be able to help cover over issues with changing platforms.
	// Most of the time this is just the differences in libraries, but there may be other
	// unforeseen issues that will come to light in the future.
	fPlatform = actualPlatform;
	
	return B_OK;
}