extensionUtils: Don't write to the filesystem on start
Create the potentially empty directory when we need to, not when we don't. https://bugzilla.gnome.org/show_bug.cgi?id=677586
This commit is contained in:
parent
3ff51da529
commit
feef35a8ca
@ -158,12 +158,6 @@ function installImporter(extension) {
|
|||||||
function init() {
|
function init() {
|
||||||
let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
|
let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
|
||||||
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
|
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
|
||||||
try {
|
|
||||||
if (!userExtensionsDir.query_exists(null))
|
|
||||||
userExtensionsDir.make_directory_with_parents(null);
|
|
||||||
} catch (e) {
|
|
||||||
logError(e, 'Could not create extensions directory');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function scanExtensionsInDirectory(callback, dir, type) {
|
function scanExtensionsInDirectory(callback, dir, type) {
|
||||||
|
@ -66,8 +66,15 @@ function gotExtensionZipFile(session, message, uuid) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
|
|
||||||
let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
|
let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
|
||||||
|
try {
|
||||||
|
if (!dir.query_exists(null))
|
||||||
|
dir.make_directory_with_parents(null);
|
||||||
|
} catch (e) {
|
||||||
|
logExtensionError('Could not create extension directory');
|
||||||
|
}
|
||||||
|
|
||||||
|
let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
|
||||||
let contents = message.response_body.flatten().as_bytes();
|
let contents = message.response_body.flatten().as_bytes();
|
||||||
stream.output_stream.write_bytes(contents, null);
|
stream.output_stream.write_bytes(contents, null);
|
||||||
stream.close(null);
|
stream.close(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user