FEditorFileUtils::PromptForCheckoutAndSave

Optionally prompts the user for which of the provided packages should be saved, and then additionally prompts the user to check-out any of the provided packages which are under source control.

Windows
MacOS
Linux

References

Module

UnrealEd

Header

/Engine/Source/Editor/UnrealEd/Public/FileHelpers.h

Include

#include "FileHelpers.h"

Source

/Engine/Source/Editor/UnrealEd/Private/FileHelpers.cpp

Syntax

static EPromptReturnCode PromptForCheckoutAndSave
(
    const TArray< UPackage * > & PackagesToSave,
    bool bCheckDirty,
    bool bPromptToSave,
    TArray< UPackage * > * OutFailedPackages,
    bool bAlreadyCheckedOut,
    bool bCanBeDeclined
)

Remarks

Optionally prompts the user for which of the provided packages should be saved, and then additionally prompts the user to check-out any of the provided packages which are under source control. If the user cancels their way out of either dialog, no packages are saved. It is possible the user will be prompted again, if the saving process fails for any reason. In that case, the user will be prompted on a package-by-package basis, allowing them to retry saving, skip trying to save the current package, or to again cancel out of the entire dialog. If the user skips saving a package that failed to save, the package will be added to the optional OutFailedPackages array, and execution will continue. After all packages are saved (or not), the user is provided with a warning about any packages that were writable on disk but not in source control, as well as a warning about which packages failed to save.

Returns

An enum value signifying success, failure, user declined, or cancellation. If any packages at all failed to save during execution, the return code will be failure, even if other packages successfully saved. If the user cancels at any point during any prompt, the return code will be cancellation, even though it is possible some packages have been successfully saved (if the cancel comes on a later package that can't be saved for some reason). If the user opts the "Don't Save" option on the dialog, the return code will indicate the user has declined out of the prompt. This way calling code can distinguish between a decline and a cancel and then proceed as planned, or abort its operation accordingly.

Parameters

Parameter

Description

PackagesToSave

The list of packages to save. Both map and content packages are supported

bCheckDirty

If true, only packages that are dirty in PackagesToSave will be saved

bPromptToSave

If true the user will be prompted with a list of packages to save, otherwise all passed in packages are saved

OutFailedPackages

[out] If specified, will be filled in with all of the packages that failed to save successfully

bAlreadyCheckedOut

If true, the user will not be prompted with the source control dialog

bCanBeDeclined

If true, offer a "Don't Save" option in addition to "Cancel", which will not result in a cancellation return code.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss