From e68a7fe31ae40af4e3006a179d67d0c9a7e0cb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 1 Apr 2021 22:05:43 +0200 Subject: [PATCH] Work around GioFile promisify bug caused by GLib 2.68 --- src/fileOps.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fileOps.js b/src/fileOps.js index 6233cd6b..52356b4d 100644 --- a/src/fileOps.js +++ b/src/fileOps.js @@ -4,9 +4,13 @@ const Misc = imports.src.misc; const { debug } = Debug; -Gio._promisify(Gio._LocalFilePrototype, 'load_bytes_async', 'load_bytes_finish'); -Gio._promisify(Gio._LocalFilePrototype, 'make_directory_async', 'make_directory_finish'); -Gio._promisify(Gio._LocalFilePrototype, 'replace_contents_bytes_async', 'replace_contents_finish'); +/* FIXME: Use Gio._LocalFilePrototype once we are safe to assume + * that GJS with https://gitlab.gnome.org/GNOME/gjs/-/commit/ec9385b8 is used. */ +const LocalFilePrototype = Gio.File.new_for_path('/').constructor.prototype; + +Gio._promisify(LocalFilePrototype, 'load_bytes_async', 'load_bytes_finish'); +Gio._promisify(LocalFilePrototype, 'make_directory_async', 'make_directory_finish'); +Gio._promisify(LocalFilePrototype, 'replace_contents_bytes_async', 'replace_contents_finish'); function createCacheDirPromise() {