[gnome-shell] extensionSystem: Use Gio.File.new_tmp



commit 0c736c45615169dc03ba99377a9de528741cec42
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu May 24 12:24:07 2012 -0400

    extensionSystem: Use Gio.File.new_tmp
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676837

 js/ui/extensionSystem.js |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 9435092..2d64acd 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -100,21 +100,12 @@ function gotExtensionZipFile(session, message, uuid) {
         return;
     }
 
-    // FIXME: use a GFile mkstemp-type method once one exists
-    let fd, tmpzip;
-    try {
-        [fd, tmpzip] = GLib.file_open_tmp('XXXXXX.shell-extension.zip');
-    } catch (e) {
-        logExtensionError(uuid, 'tempfile: ' + e.toString());
-        return;
-    }
-
-    let stream = new Gio.UnixOutputStream({ fd: fd });
+    let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
     let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
-    Shell.write_soup_message_to_stream(stream, message);
+    Shell.write_soup_message_to_stream(stream.output_stream, message);
     stream.close(null);
     let [success, pid] = GLib.spawn_async(null,
-                                          ['unzip', '-uod', dir.get_path(), '--', tmpzip],
+                                          ['unzip', '-uod', dir.get_path(), '--', file.get_path()],
                                           null,
                                           GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                                           null);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]