+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief CicoGKeyFileConfig::ConfigGetFilePath
+ * Return string value of homescreen configuration file path.
+ * If not exist, return default vlaue in params.
+ *
+ * @param[in] group_name configuration group name
+ * @param[in] key configuration name
+ * @param[in] subdir $HOME sub directory
+ * @param[in] confdir package configuration sub directory
+ * @param[in] default_path default file path
+ * @return config file path
+ */
+/*--------------------------------------------------------------------------*/
+const char *
+CicoGKeyFileConfig::ConfigGetFilePath(const char *group_name, const char *key,
+ const char *subdir, const char *confdir,
+ const char *default_path)
+{
+ GError *error = NULL;
+
+ if (m_gKeyFile != NULL) {
+ const char *value = g_key_file_get_string(m_gKeyFile, group_name, key, &error);
+ if (error == NULL) {
+ if (*value == '/') {
+ // absolute path
+ return value;
+ }
+
+ // check user home directory
+ const char *homepath = tzplatform_mkpath3(TZ_USER_HOME, subdir, value);
+ if (g_file_test(homepath, G_FILE_TEST_IS_REGULAR)) {
+ return homepath;
+ }
+
+ // check default config path
+ const char *confpath = tzplatform_mkpath3(TZ_SYS_RO_APP, confdir, value);
+ if (g_file_test(confpath, G_FILE_TEST_IS_REGULAR)) {
+ return confpath;
+ }
+ }
+ else {
+ ICO_WRN("%s", error->message);
+ g_error_free(error);
+ }
+ }
+ if (! default_path) {
+ return NULL;
+ }
+ if (*default_path == '/') {
+ return default_path;
+ }
+ return tzplatform_mkpath(TZ_SYS_RO_APP, default_path);
+}