Changeset 61519 in vbox
- Timestamp:
- Jun 7, 2016 9:04:18 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107856
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r61483 r61519 2972 2972 COMMA_LOCKVAL_SRC_POS); 2973 2973 2974 /* Set needed variables for "moving" procedure. It'll be used later in separate thread task */ 2975 rc = i_preparationForMoving(aLocation); 2976 if (FAILED(rc)) 2977 { 2978 rc = setError(VERR_NO_CHANGE, 2979 tr("Medium '%s' is already in the correct location"), 2980 i_getLocationFull().c_str()); 2981 return rc; 2974 /* play with locations */ 2975 { 2976 /*get source path and filename */ 2977 Utf8Str sourceMediumPath = i_getLocationFull(); 2978 Utf8Str sourceMediumFileName = i_getName(); 2979 2980 if (aLocation.isEmpty()) 2981 { 2982 rc = setError(VERR_PATH_ZERO_LENGTH, 2983 tr("Medium '%s' can't be moved. Destination path is empty."), 2984 i_getLocationFull().c_str()); 2985 throw rc; 2986 } 2987 2988 /*extract destination path and filename */ 2989 Utf8Str destMediumPath(aLocation); 2990 Utf8Str destMediumFileName(destMediumPath); 2991 destMediumFileName.stripPath(); 2992 2993 if (destMediumFileName.isEmpty()) 2994 { 2995 /* case when a target name is absent */ 2996 destMediumPath.append(sourceMediumFileName); 2997 } 2998 else 2999 { 3000 if (destMediumPath.equals(destMediumFileName)) 3001 { 3002 /* the passed target path consist of only a filename without directory 3003 * next move medium within the source directory with the passed new name 3004 */ 3005 destMediumPath = sourceMediumPath.stripFilename().append('/').append(destMediumFileName); 3006 } 3007 3008 /* set the target extension like on the source. Permission to convert is prohibited */ 3009 Utf8Str suffix = i_getFormat(); 3010 suffix.toLower(); 3011 destMediumPath.stripSuffix().append('.').append(suffix); 3012 } 3013 3014 if (i_isMediumFormatFile()) 3015 { 3016 /* Check path for a new file object */ 3017 rc = VirtualBox::i_ensureFilePathExists(destMediumPath, true); 3018 if (FAILED(rc)) 3019 throw rc; 3020 } 3021 else 3022 { 3023 rc = setError(VERR_NOT_A_FILE, 3024 tr("Medium '%s' isn't a file object. \"Move\" operation isn't supported."), 3025 i_getLocationFull().c_str()); 3026 throw rc; 3027 } 3028 3029 /* Set needed variables for "moving" procedure. It'll be used later in separate thread task */ 3030 rc = i_preparationForMoving(destMediumPath); 3031 if (FAILED(rc)) 3032 { 3033 rc = setError(VERR_NO_CHANGE, 3034 tr("Medium '%s' is already in the correct location"), 3035 i_getLocationFull().c_str()); 3036 throw rc; 3037 } 2982 3038 } 2983 3039 … … 2988 3044 std::vector<com::Guid>::const_iterator lastMachineID = aMachineIds.end(); 2989 3045 2990 while (currMachineID != lastMachineID)3046 while (currMachineID != lastMachineID) 2991 3047 { 2992 3048 Guid id(*currMachineID); … … 3054 3110 3055 3111 /* Do the disk moving. */ 3056 if (SUCCEEDED(rc))3112 if (SUCCEEDED(rc)) 3057 3113 { 3058 3114 ULONG mediumVariantFlags = i_getVariant();
Note:
See TracChangeset
for help on using the changeset viewer.