- Timestamp:
- May 10, 2016 3:28:15 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r60839 r60930 218 218 } 219 219 220 /* Get VBox: */ 221 CVirtualBox vbox = vboxGlobal().virtualBox(); 222 /* Get default machine folder: */ 223 const QString strDefaultMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 224 /* Fetch user's machine location: */ 225 const QString strUserMachineLocation = m_pNameAndSystemEditor->name(); 226 const QString strUserMachineFolder = QFileInfo(strUserMachineLocation).absolutePath(); 227 const QString strUserMachineBaseName = QFileInfo(strUserMachineLocation).fileName(); 228 const bool fUseDefaultPath = strUserMachineLocation == strUserMachineBaseName; 229 /* Compose machine filename: */ 230 const QString strMachineFilePath = vbox.ComposeMachineFilename(strUserMachineBaseName, 231 fUseDefaultPath ? m_strGroup : QString() /* no group in that case */, 232 QString(), 233 fUseDefaultPath ? strDefaultMachineFolder : strUserMachineFolder); 234 /* Compose machine folder/basename: */ 235 const QFileInfo fileInfo(strMachineFilePath); 236 const QString strMachineFolder = fileInfo.absolutePath(); 237 const QString strMachineBaseName = fileInfo.completeBaseName(); 220 /* Compose machine file-path, parse it to folder and base-name: */ 221 const QString strMachineFilePath = composeMachineFilePath(m_pNameAndSystemEditor->name()); 222 const QString strMachineFolder = QDir::toNativeSeparators(QFileInfo(strMachineFilePath).absolutePath()); 223 const QString strMachineBaseName = QFileInfo(strMachineFilePath).completeBaseName(); 238 224 239 225 /* Make sure that folder doesn't exists: */ … … 273 259 } 274 260 261 QString UIWizardNewVMPage1::composeMachineFilePath(const QString &strUserMachineLocation) 262 { 263 /* Get VBox: */ 264 CVirtualBox vbox = vboxGlobal().virtualBox(); 265 /* Get default machine folder: */ 266 const QString strDefaultMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 267 /* Fetch user's machine location: */ 268 const QString strUserMachineFolder = QFileInfo(strUserMachineLocation).absolutePath(); 269 const QString strUserMachineBaseName = QFileInfo(strUserMachineLocation).fileName(); 270 const bool fUseDefaultPath = strUserMachineLocation == strUserMachineBaseName; 271 /* Compose machine filename: */ 272 return vbox.ComposeMachineFilename(strUserMachineBaseName, 273 fUseDefaultPath ? m_strGroup : QString() /* no group in that case */, 274 QString(), 275 fUseDefaultPath ? strDefaultMachineFolder : strUserMachineFolder); 276 } 277 275 278 UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup) 276 279 : UIWizardNewVMPage1(strGroup) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r60839 r60930 42 42 bool createMachineFolder(); 43 43 bool cleanupMachineFolder(); 44 45 /** Composes and returns machine file-path on the basis of passed @a strUserMachineLocation. */ 46 QString composeMachineFilePath(const QString &strUserMachineLocation); 44 47 45 48 /** Returns the machine folder value. */
Note:
See TracChangeset
for help on using the changeset viewer.