| 480 | } |
| 481 | |
| 482 | FileObject* FTPSession::FindPathObject(const char * filepath) { |
| 483 | if (!filepath) |
| 484 | return NULL; |
| 485 | |
| 486 | char tempstr[MAX_PATH]; |
| 487 | strcpy(tempstr, filepath); |
| 488 | |
| 489 | FileObject * current = m_rootObject; |
| 490 | |
| 491 | char * curname = strtok (tempstr, "/"); |
| 492 | |
| 493 | while(curname) { |
| 494 | if (current->GetChildCount() == 0) //search did not finish, but cannot find child |
| 495 | return NULL; |
| 496 | |
| 497 | int i = 0; |
| 498 | int count = current->GetChildCount(); |
| 499 | for(i = 0; i < count; i++) { |
| 500 | if ( !strcmp( current->GetChild(i)->GetName(), curname ) ) { |
| 501 | current = current->GetChild(i); |
| 502 | curname = strtok (NULL, "/"); |
| 503 | break; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | if (i == count) //none of the children match |
| 508 | return NULL; |
| 509 | } |
| 510 | |
| 511 | return current; |
| 512 | } |
| 513 | |
| 514 | int FTPSession::AbortOperation() { |
| 515 | return m_mainWrapper->Abort(); |
no test coverage detected