Use $(sysconfdir)/boot-manager/last-user-context to store the LUC file
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Thu, 19 Jul 2012 12:46:11 +0000 (13:46 +0100)
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Thu, 19 Jul 2012 16:01:21 +0000 (17:01 +0100)
$(sysconfdir) is where system-wide configuration files belong.

boot-manager/Makefile.am
boot-manager/boot-manager-service.c
tests/boot-manager/Makefile.am
tests/boot-manager/test-luc-handler

index dcf60cb..422388c 100644 (file)
@@ -3,12 +3,6 @@
 SUBDIRS =                                                              \
        busconf
 
-luc_dir =                                                              \
-       $(datadir)/org.genivi.BootManager$(BOOT_MANAGER_VERSION_API)
-
-luc_path =                                                             \
-       $(luc_dir)/last-user-context
-
 boot_managerdir =                                                      \
        $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
 
@@ -49,8 +43,7 @@ boot_manager_SOURCES =                                                        \
        $(boot_manager_built_sources)
 
 boot_manager_CFLAGS =                                                  \
-       -DLUCDIR=\"$(luc_dir)\"                                         \
-       -DLUCPATH=\"$(luc_path)\"                                       \
+       -DLUC_PATH=\"$(sysconfdir)/boot-manager/last-user-context\"     \
        -DG_LOG_DOMAIN=\"boot-manager\"                                 \
        -I$(top_srcdir)                                                 \
        $(DLT_CFLAGS)                                                   \
index 6a85f2c..7aa407c 100644 (file)
@@ -473,7 +473,7 @@ boot_manager_service_read_luc (BootManagerService *service,
   g_return_val_if_fail ((error == NULL || *error == NULL), NULL);
 
   /* initialize the GFile */
-  luc_file = g_file_new_for_path (LUCPATH);
+  luc_file = g_file_new_for_path (LUC_PATH);
 
   /* read the contents of the file */
   if (!g_file_load_contents (luc_file, NULL, &data, &data_len, NULL, error))
@@ -506,8 +506,8 @@ boot_manager_service_write_luc (BootManagerService *service,
   g_return_if_fail (error == NULL || *error == NULL);
 
   /* initialize the GFiles */
-  luc_file = g_file_new_for_path (LUCPATH);
-  luc_dir = g_file_new_for_path (LUCDIR);
+  luc_file = g_file_new_for_path (LUC_PATH);
+  luc_dir = g_file_get_parent (luc_file);
 
   /* make sure the last user context's directory exists */
   g_file_make_directory_with_parents (luc_dir, NULL, &error_file);
index 10fd944..a5fd694 100644 (file)
@@ -6,11 +6,8 @@ TESTS =                                                                        \
 EXTRA_DIST =                                                           \
        test-luc-handler
 
-luc_dir =                                                              \
-       $(datadir)/org.genivi.BootManager$(BOOT_MANAGER_VERSION_API)
-
-export luc_path =                                                      \
-       $(luc_dir)/last-user-context
+export LUC_PATH =                                                      \
+       $(sysconfdir)/boot-manager/last-user-context
 
 noinst_PROGRAMS =                                                      \
        gvariant-writer
index 4d6f680..5785910 100755 (executable)
@@ -8,7 +8,7 @@
 compare_luc()
 {
   ./gvariant-writer "$1" "$2"
-  diff -q "$luc_path" "$2"
+  diff -q "$LUC_PATH" "$2"
 }
 
 # function to begin registration
@@ -50,7 +50,7 @@ fail()
 }
 
 rm -f temp
-rm -f "$luc_path"
+rm -f "$LUC_PATH"
 
 
 #Test a simple dictionary