- Timestamp:
- Nov 8, 2010 1:51:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r33809 r33841 586 586 return VERR_NO_MEMORY; 587 587 588 pNode->pszSourcePath = NULL; 589 pNode->pszDestPath = NULL; 590 if (RT_SUCCESS(RTStrAAppend(&pNode->pszSourcePath, pszFileSource))) 591 { 592 if (RT_SUCCESS(RTStrAAppend(&pNode->pszDestPath, pszFileDest))) 593 { 594 pNode->Node.pPrev = NULL; 595 pNode->Node.pNext = NULL; 596 RTListAppend(pList, &pNode->Node); 597 return VINF_SUCCESS; 598 } 588 pNode->pszSourcePath = RTStrDup(pszFileSource); 589 pNode->pszDestPath = RTStrDup(pszFileDest); 590 if ( !pNode->pszSourcePath 591 || !pNode->pszDestPath) 592 { 599 593 return VERR_NO_MEMORY; 600 594 } 601 return VERR_NO_MEMORY; 595 596 pNode->Node.pPrev = NULL; 597 pNode->Node.pNext = NULL; 598 RTListAppend(pList, &pNode->Node); 599 return VINF_SUCCESS; 602 600 } 603 601 … … 778 776 if (pszDestAbs) 779 777 { 780 RTPathStripFilename(pszDestAbs); 781 rc = RTStrAAppend(&pszDestAbs, RTPATH_SLASH_STR); 782 if (RT_SUCCESS(rc)) 778 /* Do we have a trailing slash for the destination? 779 * Then this is a directory ... */ 780 size_t cch = strlen(pszDestAbs); 781 if ( cch > 1 782 && ( RTPATH_IS_SLASH(pszDestAbs[cch - 1]) 783 || RTPATH_IS_SLASH(pszDestAbs[cch - 2]) 784 ) 785 ) 786 { 783 787 rc = RTStrAAppend(&pszDestAbs, RTPathFilename(pszSourceAbs)); 788 } 789 else 790 { 791 /* Since the desetination seems not to be a directory, 792 * we assume that this is the absolute path to the destination 793 * file -> nothing to do here ... */ 794 } 784 795 785 796 if (RT_SUCCESS(rc)) … … 1173 1184 break; 1174 1185 1175 case VERR_ PATH_NOT_FOUND:1186 case VERR_FILE_NOT_FOUND: 1176 1187 RTMsgError("Source path \"%s\" not found!\n", Utf8Source.c_str()); 1177 1188 break;
Note:
See TracChangeset
for help on using the changeset viewer.