Skip to content

aui::updater::AppropriatePortablePackagePredicate#

Determines whether the passed package name is a portable package that matches current arch and platform.

Header:#include <AUI/Updater/AppropriatePortablePackagePredicate.h>
CMake:aui_link(my_target PUBLIC aui::updater)

Detailed Description#

Custom qualifier#

aui::updater::AppropriatePortablePackagePredicate p { .qualifier = "windows-x86_64" };
EXPECT_TRUE(p("app-windows-x86_64.zip"));
EXPECT_FALSE(p("app-windows-x86.zip"));
AUI_DOCS_CODE_BEGIN

Typical usage with default qualifier#

It's convenient to use it with find_if:

struct Response {
    AString fileName;
    AString downloadUrl;
} foundFiles[] = {
    { "app-some_os-x86_64-portable.zip", "https://..." },
    { "app-some_os-arm64-portable.zip", "https://..." },
};
auto foundFilesIt =
    ranges::find_if(foundFiles, aui::updater::AppropriatePortablePackagePredicate {}, &Response::fileName);
AUI_DOCS_CODE_BEGIN

Public fields and Signals#


qualifier#

AString qualifier

Package qualifier which is expected to be present in package name.

If qualifier is empty, an AUI's package qualifier which is used as default name for portable packages is used.

Since AUI is only capable of unpacking ZIPs, this predicate checks for ".zip" extension.

Implemented as AString::contains with an additional check that "_" does not goes after, to distinguish x86_64 and x86.

Linux x86_64 -> linux-x86_64 Windows arm64 -> windows-arm64

If you wish to publish portable packages with different qualifiers, you must specify it to this variable. As AUI's package name, it's convenient to evaluate the package name in CMake and pass it to your target with target_compile_definitions.