Ejemplo n.º 1
0
status_t TElementsSorter::EvaluateRef(entry_ref &ref)
{
	struct stat st;
	BEntry entry;

	// Can we create a BEntry?
	if (entry.SetTo(&ref, false) != B_OK)
		return B_ERROR;

	// Can we get a BStatable?
	if (entry.GetStat(&st) != B_OK)
		return B_ERROR;

	// Is it a SymLink?
	if (S_ISLNK(st.st_mode))
		return HandleLink(ref, st);
	// How about a File?
	else if (S_ISREG(st.st_mode))
		return HandleFile(ref, st);
	// A Directory?
	else if (S_ISDIR(st.st_mode)) {
		BDirectory dir;
		if (dir.SetTo(&ref) != B_OK)
			return B_ERROR;

		if (dir.IsRootDirectory())
			return HandleVolume(ref, st, dir);
		else
			return HandleDirectory(ref, st, dir);
	}

	// No luck
	return B_ERROR;
}
Ejemplo n.º 2
0
status_t TQueueDialog::EvaluateRef(entry_ref &ref) 
{
	struct stat st; 
	BEntry 		entry; 
	
	// Can we create a BEntry?
	if (entry.SetTo(&ref, false) != B_OK)
	{
		ERROR("TQueueDialog::HandleRefsMessage() - BEntry SetTo() failure -\n");
		return B_ERROR; 
	}
		
	// Can we get a BStatable?
	if (entry.GetStat(&st) != B_OK) 
	{
		ERROR("TQueueDialog::HandleRefsMessage() - BEntry GetStat() failure -\n");
		return B_ERROR; 
	}
		
	// Is it a SymLink?
	if (S_ISLNK(st.st_mode)) 
		return HandleLink(ref, st);
	// How about a File?
	else if (S_ISREG(st.st_mode)) 
		return HandleFile(ref, st); 
	// A Directory?
	else if (S_ISDIR(st.st_mode)) 
	{
		BDirectory dir; 
		if (dir.SetTo(&ref) != B_OK)
		{
			return B_ERROR;
		}
			
		if (dir.IsRootDirectory()) 
			return HandleVolume(ref, st, dir); 
		else 
			return HandleDirectory(ref, st, dir); 
	} 
	
	// No luck
	return B_ERROR;
}