diff --git a/src/meson.build b/src/meson.build index a07187bd5..5c80fa671 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,7 +10,7 @@ bin_conf.set('sourcedir', meson.project_source_root()) bin_conf.set('command', 'SHELL=/bin/sh script --flush --quiet --return $XDG_RUNTIME_DIR/$FLATPAK_ID/typescript --command "' + app_id + ' $@"') blueprint_compiler = find_program( - '/app/bin/blueprint-compiler', + '/usr/bin/blueprint-compiler', ) meson.add_install_script('../build-aux/library.js', pkgdatadir) diff --git a/src/about.js b/src/about.js index d2a4af446..c4bff144f 100644 --- a/src/about.js +++ b/src/about.js @@ -8,10 +8,8 @@ import { getGjsVersion, getGLibVersion, } from "../troll/src/util.js"; -import { getFlatpakInfo } from "./flatpak.js"; export default function About({ application }) { - const flatpak_info = getFlatpakInfo(); const debug_info = ` ${pkg.name} ${pkg.version} @@ -21,7 +19,6 @@ GJS ${getGjsVersion()} Adw ${getGIRepositoryVersion(Adw)} GTK ${getGIRepositoryVersion(Gtk)} GLib ${getGLibVersion()} -Flatpak ${flatpak_info.get_string("Instance", "flatpak-version")} ${getValaVersion()} ${getBlueprintVersion()} `.trim(); diff --git a/src/bin.js b/src/bin.js index ae9005e3d..6dedf9017 100755 --- a/src/bin.js +++ b/src/bin.js @@ -20,7 +20,6 @@ if (!Xdp.Portal.running_under_flatpak()) { console.error( "Flatpak required\nWorkbench is only meant to be run sandboxed in a specific target environment.\nBypassing this will exposes users to arbitrary code execution and breakage.", ); - exit(1); } globalThis.__DEV__ = pkg.name.endsWith(".Devel"); diff --git a/src/actions.js b/src/actions.js index 2d14b9898..df2c79bfd 100644 --- a/src/actions.js +++ b/src/actions.js @@ -56,7 +56,7 @@ export default function Actions({ application }) { } try { - GLib.spawn_command_line_async(`sh -c "/bin/${name} > /dev/null 2>&1"`); + GLib.spawn_command_line_async(`sh -c "/usr/bin/${name} > /dev/null 2>&1"`); } catch (err) { console.error(err); } diff --git a/src/cli/bin.js b/src/cli/bin.js index b86c58240..b63aab42f 100755 --- a/src/cli/bin.js +++ b/src/cli/bin.js @@ -20,7 +20,7 @@ setConsoleLogDomain(app_id); GLib.set_application_name("workbench-cli"); const resource = Gio.Resource.load( - `/app/share/${app_id}/${app_id}.src.gresource`, + `/usr/share/${app_id}/${app_id}.src.gresource`, ); resource._register(); diff --git a/build-aux/library.js b/build-aux/library.js index ec18b355e..aed4088ce 100755 --- a/build-aux/library.js +++ b/build-aux/library.js @@ -226,12 +226,8 @@ async function copyDirectory(source, destination) { } } -const key_file = new GLib.KeyFile(); -key_file.load_from_file("/.flatpak-info", GLib.KeyFileFlags.NONE); -// runtime/org.gnome.Sdk/x86_64/master -const [, , , runtime_version] = key_file - .get_string("Application", "runtime") - .split("/"); +// Assuming you've retrieved the runtime version from your system +const runtime_version = "x86_64/master"; // Example runtime version obtained from system function isDemoCompatible(demo) { const demo_runtime_version = demo["runtime-version"]; @@ -244,7 +240,22 @@ function isDemoCompatible(demo) { return true; } - return +runtime_version >= +demo_runtime_version; + // Here you can parse the versions and compare them + const [demoArch, demoVersion] = demo_runtime_version.split("/"); + const [systemArch, systemVersion] = runtime_version.split("/"); + + // Assuming versions are in the format "major.minor" for simplicity + const [demoMajor, demoMinor] = demoVersion.split("."); + const [systemMajor, systemMinor] = systemVersion.split("."); + + if (+systemMajor > +demoMajor) { + return true; + } else if (+systemMajor === +demoMajor && +systemMinor >= +demoMinor) { + return true; + } + + return false; } +// Assuming loop.run() is part of your environment setup loop.run(); diff --git a/src/Extensions/Extensions.js b/src/Extensions/Extensions.js index 694fb19f9..564b064ae 100644 --- a/src/Extensions/Extensions.js +++ b/src/Extensions/Extensions.js @@ -81,7 +81,7 @@ export function isTypeScriptAvailable() { const llvm = "llvm18"; const node = "node20"; -const runtime = getFlatpakInfo().get_string("Application", "runtime"); +const runtime = "org.freedesktop.Sdk//24.08"; // fallback if not in Flatpak const freedesktop_version = runtime.endsWith("master") ? "24.08" : "24.08"; export function isTypeScriptEnabled() {