Ensure folder existing when saving source

This commit is contained in:
Christian Dywan 2012-07-08 21:28:53 +02:00
parent a0b2020550
commit f9005c63a7

View file

@ -5457,9 +5457,11 @@ midori_view_save_source (MidoriView* view,
if (!outfile)
{
gchar* extension = midori_view_get_uri_extension (uri);
unique_filename = g_strdup_printf ("%s/midori-%s/%uXXXXXX%s",
g_get_tmp_dir (), g_get_user_name (),
gchar* tmpdir = g_strdup_printf ("%s/midori-%s", g_get_tmp_dir (), g_get_user_name ());
g_mkdir (tmpdir, 0700);
unique_filename = g_strdup_printf ("%s/%uXXXXXX%s", tmpdir,
g_str_hash (uri), midori_view_fallback_extension (view, extension));
g_free (tmpdir);
g_free (extension);
fd = g_mkstemp (unique_filename);
}