Skip to content

build/api-examples/FileExplorer.cpp

Complete program from the FileExplorer API reference. Save it at the path shown above and use the build command in the reference page.

Source files · Download FileExplorer.cpp

#include "desktop_native.hpp"
#include <cstdio>
#include <cstring>

int main()
{
    gaspardos::desktop::NativeFileAccess access;
    gaspardos::desktop::FileExplorer     explorer(access);
    explorer.begin(gaspardos::desktop::FileExplorer::SelectFolder, "/AHCIDISK0");
    for (unsigned i = 0; i < 10000 && explorer.loading(); ++i)
    {
        explorer.tick();
        GO64_yield();
    }
    if (explorer.loading() || !explorer.accept(""))
        return 1;
    return explorer.accepted() ? 0 : 1;
}