Changeset 75418 in vbox
- Timestamp:
- Nov 13, 2018 12:09:09 PM (6 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/RecordingSettingsImpl.h
r75361 r75418 56 56 void i_applyDefaults(void); 57 57 58 int i_getDefaultFileName(Utf8Str &strFile );58 int i_getDefaultFileName(Utf8Str &strFile, bool fWithFileExtension); 59 59 bool i_canChangeSettings(void); 60 60 void i_onSettingsChanged(void); -
trunk/src/VBox/Main/src-server/RecordingScreenSettingsImpl.cpp
r75366 r75418 371 371 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 372 372 373 aFileName = m->bd->File.strName; 374 375 return S_OK; 376 } 377 378 HRESULT RecordingScreenSettings::setFileName(const com::Utf8Str &aFileName) 379 { 380 AutoCaller autoCaller(this); 381 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 382 383 if (!m->pParent->i_canChangeSettings()) 384 return setError(E_INVALIDARG, tr("Cannot change file name while recording is enabled")); 385 386 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 387 388 /* Get default file name if an empty string or a single "." is passed. */ 389 Utf8Str strFile(aFileName); 390 if ( strFile.isEmpty() 391 || strFile.equals(".")) 392 { 393 int vrc = m->pParent->i_getDefaultFileName(strFile); 373 /* Get default file name if an empty string or a single "." is set. */ 374 if ( m->bd->File.strName.isEmpty() 375 || m->bd->File.strName.equals(".")) 376 { 377 int vrc = m->pParent->i_getDefaultFileName(m->bd->File.strName, true /* fWithFileExtension */); 394 378 if (RT_FAILURE(vrc)) 395 379 return setError(E_INVALIDARG, tr("Error retrieving default file name")); 396 380 } 397 381 382 aFileName = m->bd->File.strName; 383 384 return S_OK; 385 } 386 387 HRESULT RecordingScreenSettings::setFileName(const com::Utf8Str &aFileName) 388 { 389 AutoCaller autoCaller(this); 390 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 391 392 if (!m->pParent->i_canChangeSettings()) 393 return setError(E_INVALIDARG, tr("Cannot change file name while recording is enabled")); 394 395 Utf8Str strFile(aFileName); 398 396 if (!RTPathStartsWithRoot(strFile.c_str())) 399 397 return setError(E_INVALIDARG, tr("Recording file name '%s' is not absolute"), strFile.c_str()); 398 399 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 400 400 401 401 m->bd.backup(); … … 817 817 { 818 818 if (m->bd->File.strName.isEmpty()) 819 rc = m->pParent->i_getDefaultFileName(m->bd->File.strName );819 rc = m->pParent->i_getDefaultFileName(m->bd->File.strName, true /* fWithExtension */); 820 820 break; 821 821 } -
trunk/src/VBox/Main/src-server/RecordingSettingsImpl.cpp
r75367 r75418 566 566 * Returns the full path to the default video capture file. 567 567 */ 568 int RecordingSettings::i_getDefaultFileName(Utf8Str &strFile )568 int RecordingSettings::i_getDefaultFileName(Utf8Str &strFile, bool fWithFileExtension) 569 569 { 570 570 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 572 572 strFile = m->pMachine->i_getSettingsFileFull(); // path/to/machinesfolder/vmname/vmname.vbox 573 573 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname 574 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm 574 if (fWithFileExtension) 575 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm 575 576 576 577 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.