AssetImport.h header
#include <ew/app/AssetImport.h>
Namespace ew::app
Functions
ew::core::Result< QString > ew::app::importAsset(const QString &projectDir, const QString &sourceFile)
Copies the file sourceFile into projectDir's assets/ folder (created if needed), choosing a unique name if one already exists, and returns the project-relative path (e.g. "assets/cover.png") on success or an Error on failure. Used to bring media and other attachments into the folder-of-text project so they version alongside it.
ew::core::ContentId ew::app::mediaWithAssetPath(const ew::core::Project &project, const QString &assetPath)
Returns the id of the first Media object in project whose assetPath() equals assetPath, or a null id when none references it. Lets a document-image insert (or a gallery-to-document drop) reuse the gallery Media for an already-imported asset instead of creating a duplicate, so the gallery stays the single source of truth for the project's media.