virtual void check(const unit_minus::AssertionInfo& info) { if (info.successful()) return; throw FailureInfo( m_file, m_line, (info.hasMessage() ? info.message() : info.rawMessage())); }
void FMoviePlayerSettingsDetails::HandleFilePathPickerPathPicked( const FString& PickedPath, TSharedRef<IPropertyHandle> Property ) { FEditorDirectories::Get().SetLastDirectory(ELastDirectory::GENERIC_OPEN, FPaths::GetPath(PickedPath)); // sanitize the location of the chosen movies to the content/movies directory const FString MoviesBaseDir = FPaths::ConvertRelativePathToFull(FPaths::GameContentDir() + TEXT("Movies/")); const FString FullPath = FPaths::ConvertRelativePathToFull(PickedPath); if (FullPath.StartsWith(MoviesBaseDir)) { // mark for add/checkout FText FailReason; if (SourceControlHelpers::CheckoutOrMarkForAdd(PickedPath, LOCTEXT("MovieFileDescription", "movie"), FOnPostCheckOut(), FailReason)) { // already in the movies dir, so just trim the path so we just have a partial path with no extension (the movie player expects this) Property->SetValue(FPaths::GetBaseFilename(FullPath.RightChop(MoviesBaseDir.Len()))); } else { FNotificationInfo Info(FailReason); Info.ExpireDuration = 3.0f; FSlateNotificationManager::Get().AddNotification(Info); } } else if (!PickedPath.IsEmpty()) { // ask the user if they want to import this movie FSuppressableWarningDialog::FSetupInfo Info( LOCTEXT("ExternalMovieImportWarning", "This movie needs to be copied into your project, would you like to copy the file now?"), LOCTEXT("ExternalMovieImportTitle", "Copy Movie"), TEXT("ImportMovieIntoProject") ); Info.ConfirmText = LOCTEXT("ExternalMovieImport_Confirm", "Copy"); Info.CancelText = LOCTEXT("ExternalMovieImport_Cancel", "Don't Copy"); FSuppressableWarningDialog ImportWarningDialog( Info ); if(ImportWarningDialog.ShowModal() != FSuppressableWarningDialog::EResult::Cancel) { const FString FileName = FPaths::GetCleanFilename(PickedPath); const FString DestPath = MoviesBaseDir / FileName; FText FailReason; if (SourceControlHelpers::CopyFileUnderSourceControl(DestPath, PickedPath, LOCTEXT("MovieFileDescription", "movie"), FailReason)) { // trim the path so we just have a partial path with no extension (the movie player expects this) Property->SetValue(FPaths::GetBaseFilename(DestPath.RightChop(MoviesBaseDir.Len()))); } else { FNotificationInfo FailureInfo(FailReason); FailureInfo.ExpireDuration = 3.0f; FSlateNotificationManager::Get().AddNotification(FailureInfo); } } } else { Property->SetValue(PickedPath); } }