Ticket #1034: Directory.cpp.diff
File Directory.cpp.diff, 1.9 KB (added by , 17 years ago) |
---|
-
/boot/home/Desktop/Directory.cpp
old new 480 480 bool 481 481 BDirectory::Contains(const BEntry *entry, int32 nodeFlags) const 482 482 { 483 bool result = (entry); 484 // check, if the entry exists at all 485 if (result) 486 result = entry->Exists(); 483 if (entry == NULL) 484 return false; 485 486 if (entry->InitCheck() != B_OK) 487 return false; 488 489 if (! entry->Exists()) 490 return false; 491 487 492 // test the node kind 488 if (result) {489 switch (nodeFlags) {490 case B_FILE_NODE:491 re sult = entry->IsFile();492 493 494 result = entry->IsDirectory();495 break;496 case B_SYMLINK_NODE:497 result = entry->IsSymLink();498 break;499 case B_ANY_NODE:500 501 default:502 result = false;503 break;504 }493 switch (nodeFlags) { 494 case B_FILE_NODE: 495 if (! entry->IsFile()) 496 return false; 497 break; 498 case B_DIRECTORY_NODE: 499 if (! entry->IsDirectory()) 500 return false; 501 break; 502 case B_SYMLINK_NODE: 503 if (! entry->IsSymLink()) 504 return false; 505 break; 506 case B_ANY_NODE: 507 break; 508 default: 509 break; 505 510 } 511 506 512 // If the directory is initialized, get the canonical paths of the dir and 507 513 // the entry and check, if the latter is a prefix of the first one. 508 if ( result &&InitCheck() == B_OK) {514 if (InitCheck() == B_OK) { 509 515 BPath dirPath(this, ".", true); 510 516 BPath entryPath(entry); 511 if (dirPath.InitCheck() == B_OK && entryPath.InitCheck() == B_OK) { 512 result = !strncmp(dirPath.Path(), entryPath.Path(), 513 strlen(dirPath.Path())); 514 } else 515 result = false; 517 518 if (! (dirPath.InitCheck() == B_OK && entryPath.InitCheck() == B_OK)) 519 return false; 520 521 if (!strncmp(dirPath.Path(), entryPath.Path(), strlen(dirPath.Path()))) 522 return true; 523 else 524 return false; 516 525 } 517 return result; 526 else 527 return false; 518 528 } 519 529 520 530 // GetStatFor