[Xfce4-commits] <midori:master> Check for destination folder before downloading userstyle/script
Christian Dywan
noreply at xfce.org
Wed Feb 9 00:32:04 CET 2011
Updating branch refs/heads/master
to 28fbf66459e645ad03655c55150eddc3f5e0da69 (commit)
from dba9bb478064882e20cf0beaab58b2741b4d5ded (commit)
commit 28fbf66459e645ad03655c55150eddc3f5e0da69
Author: Paweł Forysiuk <tuxator at o2.pl>
Date: Sat Feb 5 23:01:46 2011 +0100
Check for destination folder before downloading userstyle/script
extensions/addons.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/extensions/addons.c b/extensions/addons.c
index eb23f43..74ff22c 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -108,7 +108,7 @@ addons_install_response (GtkWidget* infobar,
if (uri && *uri)
{
gchar** split_uri;
- gchar* path, *filename, *hostname, *dest_path, *temp_uri;
+ gchar* path, *filename, *hostname, *dest_path, *temp_uri, *folder_path;
const gchar* folder;
WebKitNetworkRequest* request;
WebKitDownload* download;
@@ -188,8 +188,12 @@ addons_install_response (GtkWidget* infobar,
if (!filename)
filename = g_path_get_basename (uri);
- path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
- PACKAGE_NAME, folder, filename, NULL);
+ folder_path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
+ PACKAGE_NAME, folder, NULL);
+
+ if (!g_file_test (folder_path, G_FILE_TEST_EXISTS))
+ katze_mkdir_with_parents (folder_path, 0700);
+ path = g_build_path (G_DIR_SEPARATOR_S, folder_path, filename, NULL);
request = webkit_network_request_new (uri);
download = webkit_download_new (request);
@@ -203,6 +207,7 @@ addons_install_response (GtkWidget* infobar,
g_free (path);
g_free (temp_uri);
g_free (dest_path);
+ g_free (folder_path);
g_strfreev (split_uri);
}
}
More information about the Xfce4-commits
mailing list