Changeset 33791 in vbox
- Timestamp:
- Nov 5, 2010 12:55:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r33790 r33791 630 630 int rc = VINF_SUCCESS; 631 631 char szCurDir[RTPATH_MAX]; 632 /* Construct current path. */ 632 633 if (RTStrPrintf(szCurDir, sizeof(szCurDir), pszRootDir)) 633 634 { 634 635 if (pszSubDir != NULL) 635 636 rc = RTPathAppend(szCurDir, sizeof(szCurDir), pszSubDir); 636 if (RT_SUCCESS(rc) && pszFilter != NULL)637 rc = RTPathAppend(szCurDir, sizeof(szCurDir), pszFilter);638 637 } 639 638 else 640 639 rc = VERR_NO_MEMORY; 641 640 642 if (pszFilter) 643 rc = RTDirOpenFiltered(&pDir, szCurDir, 644 #ifdef RT_OS_WINDOWS 645 RTDIRFILTER_WINNT); 646 #else 647 RTDIRFILTER_UNIX); 648 #endif 649 else 641 if (RT_SUCCESS(rc)) 642 { 643 /* Open directory without a filter - RTDirOpenFiltered unfortunately 644 * cannot handle sub directories so we have to do the filtering ourselves. */ 650 645 rc = RTDirOpen(&pDir, szCurDir); 651 652 if (RT_SUCCESS(rc)) 653 { 654 for (;;) 646 for (;RT_SUCCESS(rc);) 655 647 { 656 648 RTDIRENTRY DirEntry; … … 692 684 case RTDIRENTRYTYPE_FILE: 693 685 { 694 char *pszFileSource = NULL; 695 char *pszFileDest = NULL; 696 if (RTStrAPrintf(&pszFileSource, "%s%s%s", 697 pszRootDir, pszSubDir ? pszSubDir : "", 698 DirEntry.szName) >= 0) 686 bool fProcess = false; 687 if (pszFilter && RTStrSimplePatternMatch(pszFilter, DirEntry.szName)) 688 fProcess = true; 689 else if (!pszFilter) 690 fProcess = true; 691 692 if (fProcess) 699 693 { 700 if (RTStrAPrintf(&pszFileDest, "%s%s", 701 pszSubDir ? pszSubDir : "", 702 DirEntry.szName) <= 0) 694 char *pszFileSource = NULL; 695 char *pszFileDest = NULL; 696 if (RTStrAPrintf(&pszFileSource, "%s%s%s", 697 pszRootDir, pszSubDir ? pszSubDir : "", 698 DirEntry.szName) >= 0) 703 699 { 700 if (RTStrAPrintf(&pszFileDest, "%s%s", 701 pszSubDir ? pszSubDir : "", 702 DirEntry.szName) <= 0) 703 { 704 rc = VERR_NO_MEMORY; 705 } 706 } 707 else 704 708 rc = VERR_NO_MEMORY; 709 710 if (RT_SUCCESS(rc)) 711 { 712 rc = ctrlCopyDirectoryEntryAppend(pszFileSource, pszFileDest, pList); 713 if (RT_SUCCESS(rc)) 714 *pcObjects = *pcObjects + 1; 705 715 } 716 717 if (pszFileSource) 718 RTStrFree(pszFileSource); 719 if (pszFileDest) 720 RTStrFree(pszFileDest); 706 721 } 707 else 708 rc = VERR_NO_MEMORY; 709 710 if (RT_SUCCESS(rc)) 711 { 712 rc = ctrlCopyDirectoryEntryAppend(pszFileSource, pszFileDest, pList); 713 if (RT_SUCCESS(rc)) 714 *pcObjects = *pcObjects + 1; 715 } 716 717 if (pszFileSource) 718 RTStrFree(pszFileSource); 719 if (pszFileDest) 720 RTStrFree(pszFileDest); 721 break; 722 } 722 } 723 break; 723 724 724 725 case RTDIRENTRYTYPE_SYMLINK:
Note:
See TracChangeset
for help on using the changeset viewer.

