Changeset 31482 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 9, 2010 12:55:33 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64564
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r31481 r31482 481 481 AssertReturn(autoInitSpan.isOk(), E_FAIL); 482 482 483 Utf8Str strConfigFile(aParent->getDefaultMachineFolder()); 484 strConfigFile.append(Utf8StrFmt("%c%s%c%s.xml", 485 RTPATH_DELIMITER, 486 strName.c_str(), 487 RTPATH_DELIMITER, 488 strName.c_str())); 483 Utf8Str strConfigFile; 484 aParent->getDefaultMachineFolder(strConfigFile); 485 strConfigFile.append(RTPATH_DELIMITER); 486 strConfigFile.append(strName); 487 strConfigFile.append(RTPATH_DELIMITER); 488 strConfigFile.append(strName); 489 strConfigFile.append(".xml"); 489 490 490 491 HRESULT rc = initImpl(aParent, strConfigFile); -
trunk/src/VBox/Main/MediumImpl.cpp
r31481 r31482 3063 3063 * the specified location, and -1 otherwise. 3064 3064 */ 3065 HRESULT Medium::compareLocationTo(const char *aLocation, int &aResult)3065 HRESULT Medium::compareLocationTo(const Utf8Str &strLocation, int &aResult) 3066 3066 { 3067 3067 AutoCaller autoCaller(this); … … 3076 3076 if (m->formatObj->getCapabilities() & MediumFormatCapabilities_File) 3077 3077 { 3078 Utf8Str location (aLocation);3078 Utf8Str location; 3079 3079 3080 3080 /* For locations represented by files, append the default path if 3081 3081 * only the name is given, and then get the full path. */ 3082 if (!RTPathHavePath(aLocation)) 3083 { 3084 location = Utf8StrFmt("%s%c%s", 3085 m->pVirtualBox->getDefaultHardDiskFolder().raw(), 3086 RTPATH_DELIMITER, 3087 aLocation); 3088 } 3082 if (!RTPathHavePath(strLocation.c_str())) 3083 { 3084 m->pVirtualBox->getDefaultHardDiskFolder(location); 3085 location.append(RTPATH_DELIMITER); 3086 location.append(strLocation); 3087 } 3088 else 3089 location = strLocation; 3089 3090 3090 3091 int vrc = m->pVirtualBox->calculateFullPath(location, location); … … 3098 3099 } 3099 3100 else 3100 aResult = locationFull.compare( aLocation);3101 aResult = locationFull.compare(strLocation); 3101 3102 3102 3103 return S_OK; … … 3204 3205 /* check that our own format supports diffs */ 3205 3206 if (!(m->formatObj->getCapabilities() & MediumFormatCapabilities_Differencing)) 3207 { 3206 3208 /* use the default format if not */ 3207 return m->pVirtualBox->getDefaultHardDiskFormat(); 3209 Utf8Str tmp; 3210 m->pVirtualBox->getDefaultHardDiskFormat(tmp); 3211 return tmp; 3212 } 3208 3213 3209 3214 /* m->strFormat is const, no need to lock */ … … 3320 3325 /* append the default folder if no path is given */ 3321 3326 if (!RTPathHavePath(location.c_str())) 3322 location = Utf8StrFmt("%s%c%s", 3323 m->pVirtualBox->getDefaultHardDiskFolder().raw(), 3324 RTPATH_DELIMITER, 3325 location.raw()); 3327 { 3328 Utf8Str tmp; 3329 m->pVirtualBox->getDefaultHardDiskFolder(tmp); 3330 tmp.append(RTPATH_DELIMITER); 3331 tmp.append(location); 3332 location = tmp; 3333 } 3326 3334 3327 3335 /* get the full file name */ -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r31481 r31482 1139 1139 if (strSettingsFile.isEmpty()) 1140 1140 /* we use the non-full folder value below to keep the path relative */ 1141 strSettingsFile = getDefaultMachineFolder();1141 getDefaultMachineFolder(strSettingsFile); 1142 1142 1143 1143 strSettingsFile = Utf8StrFmt("%s%c%ls%c%ls.xml", … … 1378 1378 Utf8Str format(aFormat); 1379 1379 if (format.isEmpty()) 1380 format = getDefaultHardDiskFormat();1380 getDefaultHardDiskFormat(format); 1381 1381 1382 1382 HRESULT rc = E_FAIL; … … 2745 2745 const ComObjPtr<Medium> &hd = (*it).second; 2746 2746 2747 HRESULT rc = hd->compareLocationTo(location .c_str(), result);2747 HRESULT rc = hd->compareLocationTo(location, result); 2748 2748 if (FAILED(rc)) return rc; 2749 2749 … … 2979 2979 * @return 2980 2980 */ 2981 Utf8Str VirtualBox::getDefaultMachineFolder() const2981 void VirtualBox::getDefaultMachineFolder(Utf8Str &str) const 2982 2982 { 2983 2983 AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS); 2984 returnm->pSystemProperties->m->strDefaultMachineFolder;2984 str = m->pSystemProperties->m->strDefaultMachineFolder; 2985 2985 } 2986 2986 … … 2990 2990 * @return 2991 2991 */ 2992 Utf8Str VirtualBox::getDefaultHardDiskFolder() const2992 void VirtualBox::getDefaultHardDiskFolder(Utf8Str &str) const 2993 2993 { 2994 2994 AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS); 2995 returnm->pSystemProperties->m->strDefaultHardDiskFolder;2995 str = m->pSystemProperties->m->strDefaultHardDiskFolder; 2996 2996 } 2997 2997 … … 3001 3001 * @return 3002 3002 */ 3003 Utf8Str VirtualBox::getDefaultHardDiskFormat() const3003 void VirtualBox::getDefaultHardDiskFormat(Utf8Str &str) const 3004 3004 { 3005 3005 AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS); 3006 returnm->pSystemProperties->m->strDefaultHardDiskFormat;3006 str = m->pSystemProperties->m->strDefaultHardDiskFormat; 3007 3007 } 3008 3008 -
trunk/src/VBox/Main/include/MediumImpl.h
r31479 r31482 198 198 HRESULT saveSettings(settings::Medium &data); 199 199 200 HRESULT compareLocationTo(const char *aLocation, int &aResult);200 HRESULT compareLocationTo(const Utf8Str &strLocation, int &aResult); 201 201 202 202 HRESULT createMediumLockList(bool fFailIfInaccessible, -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r31358 r31482 242 242 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 243 243 244 Utf8Str getDefaultMachineFolder() const;245 Utf8Str getDefaultHardDiskFolder() const;246 Utf8Str getDefaultHardDiskFormat() const;244 void getDefaultMachineFolder(Utf8Str &str) const; 245 void getDefaultHardDiskFolder(Utf8Str &str) const; 246 void getDefaultHardDiskFormat(Utf8Str &str) const; 247 247 248 248 /** Returns the VirtualBox home directory */
Note:
See TracChangeset
for help on using the changeset viewer.