diff --git a/build-aux/library.js b/build-aux/library.js index d0d181357..ee2704774 100755 --- a/build-aux/library.js +++ b/build-aux/library.js @@ -63,6 +63,10 @@ const demos = []; const demo = JSON.parse(str); demo.name = file_info.get_name(); + if (!isDemoCompatible(demo)) { + continue; + } + const languages = []; if (demo_dir.get_child("main.js").query_exists(null)) { languages.push("javascript"); @@ -107,8 +111,6 @@ const demos = []; loop.quit(); }); -loop.run(); - async function copyDemo(source, destination) { try { destination.make_directory_with_parents(null); @@ -171,7 +173,7 @@ async function copyDemo(source, destination) { } } -export async function copyDirectory(source, destination) { +async function copyDirectory(source, destination) { const enumerator = await source.enumerate_children_async( `${Gio.FILE_ATTRIBUTE_STANDARD_NAME},${Gio.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN}`, Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, @@ -206,3 +208,28 @@ export async function copyDirectory(source, destination) { } } } + +const keyFile = new GLib.KeyFile(); +keyFile.load_from_file("/.flatpak-info", GLib.KeyFileFlags.NONE); +// runtime/org.gnome.Sdk/x86_64/master +const [, , , runtime_version] = keyFile + .get_string("Application", "runtime") + .split("/"); + +function isDemoCompatible(demo) { + const demo_runtime_version = demo["runtime-version"]; + + if (demo_runtime_version === "master") { + return runtime_version === "master"; + } else if (runtime_version === "master") { + return true; + } else if (!demo_runtime_version) { + return true; + } + + console.log(+runtime_version, +demo_runtime_version); + + return +runtime_version >= +demo_runtime_version; +} + +loop.run(); diff --git a/demos b/demos index f2f96fd5b..80fe24015 160000 --- a/demos +++ b/demos @@ -1 +1 @@ -Subproject commit f2f96fd5b893c29d17ba78dc4ebdbc0012541935 +Subproject commit 80fe240150a6ac6e8a488b305fda5fc091e49bc1 diff --git a/src/application.js b/src/application.js index 9e8c501a3..9dcae0ddf 100644 --- a/src/application.js +++ b/src/application.js @@ -27,6 +27,7 @@ import "./icons/re.sonny.Workbench-larger-brush-symbolic.svg" with { type: "icon import "./icons/re.sonny.Workbench-terminal-symbolic.svg" with { type: "icon" }; import "./icons/re.sonny.Workbench-test-pass-symbolic.svg" with { type: "icon" }; import "./icons/re.sonny.Workbench-up-symbolic.svg" with { type: "icon" }; +import "./icons/re.sonny.Workbench-library-symbolic.svg" with { type: "icon" }; ensureDir(data_dir);