extensionSystem: Use Gio.File.new_tmp
https://bugzilla.gnome.org/show_bug.cgi?id=676837
This commit is contained in:
parent
33ad9d1035
commit
0c736c4561
@ -100,21 +100,12 @@ function gotExtensionZipFile(session, message, uuid) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: use a GFile mkstemp-type method once one exists
|
let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
|
||||||
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 dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
|
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);
|
stream.close(null);
|
||||||
let [success, pid] = GLib.spawn_async(null,
|
let [success, pid] = GLib.spawn_async(null,
|
||||||
['unzip', '-uod', dir.get_path(), '--', tmpzip],
|
['unzip', '-uod', dir.get_path(), '--', file.get_path()],
|
||||||
null,
|
null,
|
||||||
GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
|
GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
|
||||||
null);
|
null);
|
||||||
|
Loading…
Reference in New Issue
Block a user