class ProjectLibrarySaveResourceAsOperation

Project library operation that saves a resource a the specified location.

Note the operation cannot overwrite existing files.

Public

Constructors

ProjectLibrarySaveResourceAsOperation

ProjectLibrarySaveResourceAsOperation(const ProjectLibraryOperationContext &context, const HResource &resource, const Path &relativePath)

Constructs the operation.

context
Project library context the operation is being executed in.
resource
Resource instance to add to the library. A copy of the resource will be saved at the provided path.
relativePath
Path where where to store the resource, relative to the project library imported resources folder.

Methods

PrepareOnMainThread

Result PrepareOnMainThread() override

Performs the first stage of the operation.

Verifies the input parameters are correct, creates library database entries (if possible) and returns success if operation will proceed to execute. Executed on the main thread.

Returns: Operation result and optional error message if failed.

RunOnWorkerThread

void RunOnWorkerThread() override

Performs the second stage of the operation.

Performs longer lasting tasks such as saving or loading a package, copying a file or generating preview icons. Executed on a worker thread.

FinalizeOnMainThread

void FinalizeOnMainThread() override

Performs the last stage of the operation.

This will be called after the worker thread completes. Will ensure the entries in the project library database match to packages written by the worker thread.

Private

Fields

mResource

HResource mResource

mRelativePath

Path mRelativePath