MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / FindPathObject

Method FindPathObject

src/FTPSession.cpp:482–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482FileObject* 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
514int FTPSession::AbortOperation() {
515 return m_mainWrapper->Abort();

Callers 1

OnEventMethod · 0.80

Calls 3

GetChildCountMethod · 0.45
GetNameMethod · 0.45
GetChildMethod · 0.45

Tested by

no test coverage detected