[gnome-initial-setup/shell/4765: 347/362] Possible fix for barcode sometimes not showing up on initial boot



commit 26e519fc9c89934e322843dd945285830a10c57e
Author: Srdjan Grubor <sgnn7 sgnn7 org>
Date:   Fri Mar 6 14:07:54 2015 -0600

    Possible fix for barcode sometimes not showing up on initial boot
    
    While we can't pinpoint the reason for the barcode disappearing, the
    best guess is that sometiumes the cache dir is being created by some
    other method that might encounter a race condition with GIS so this fix
    makes sure that we have that directory before trying to write the
    barcode image to it.

 .../pages/language/gis-language-page.c             |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c 
b/gnome-initial-setup/pages/language/gis-language-page.c
index ce700e4..73faad8 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -209,9 +209,15 @@ static gchar *
 create_serial_barcode (const gchar *serial)
 {
   gchar *savefile;
+  const gchar *cache_dir;
   struct zint_symbol *barcode;
 
-  savefile = g_build_filename (g_get_user_cache_dir (), "product_serial.png", NULL);
+  cache_dir = g_get_user_cache_dir ();
+
+  /* Create the directory if it's missing */
+  g_mkdir_with_parents (cache_dir, 0755);
+
+  savefile = g_build_filename (cache_dir, "product_serial.png", NULL);
 
   barcode = ZBarcode_Create();
   strncpy ((char *) barcode->outfile, savefile, 4096);


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