/* Searches for a file fragment paths set via GNC_DOC_PATH environment * variable. If this variable is not set, fall back to search in * - a html directory in the local user's gnucash settings directory * (typically $HOME/.gnucash/html) * - the gnucash documentation directory * (typically /usr/share/doc/gnucash) * - the gnucash data directory * (typically /usr/share/gnucash) * It searches in this order. * * This is used by gnc_path_find_localized_file to search for * localized versions of files if they exist. */ static gchar * gnc_path_find_localized_html_file_internal (const gchar * file_name) { gchar *full_path = NULL; int i; const gchar *env_doc_path = g_getenv("GNC_DOC_PATH"); const gchar *default_dirs[] = { gnc_build_dotgnucash_path ("html"), gnc_path_get_pkgdocdir (), gnc_path_get_pkgdatadir (), NULL }; gchar **dirs; if (!file_name || *file_name == '\0') return NULL; /* Allow search path override via GNC_DOC_PATH environment variable */ if (env_doc_path) dirs = g_strsplit (env_doc_path, G_SEARCHPATH_SEPARATOR_S, -1); else dirs = (gchar **)default_dirs; for (i = 0; dirs[i]; i++) { full_path = g_build_filename (dirs[i], file_name, (gchar *)NULL); DEBUG ("Checking for existence of %s", full_path); full_path = check_path_return_if_valid (full_path); if (full_path != NULL) return full_path; } return NULL; }
static void gnc_log_init() { if (log_to_filename != NULL) { qof_log_init_filename_special(log_to_filename); } else { /* initialize logging to our file. */ gchar *tracefilename; tracefilename = g_build_filename(g_get_tmp_dir(), "gnucash.trace", (gchar *)NULL); qof_log_init_filename(tracefilename); g_free(tracefilename); } // set a reasonable default. qof_log_set_default(QOF_LOG_WARNING); gnc_log_default(); if (gnc_is_debugging()) { qof_log_set_level("", QOF_LOG_INFO); qof_log_set_level("qof", QOF_LOG_INFO); qof_log_set_level("gnc", QOF_LOG_INFO); } { gchar *log_config_filename; log_config_filename = gnc_build_dotgnucash_path("log.conf"); if (g_file_test(log_config_filename, G_FILE_TEST_EXISTS)) qof_log_parse_log_config(log_config_filename); g_free(log_config_filename); } if (log_flags != NULL) { int i = 0; for (; log_flags[i] != NULL; i++) { QofLogLevel level; gchar **parts = NULL; gchar *log_opt = log_flags[i]; parts = g_strsplit(log_opt, "=", 2); if (parts == NULL || parts[0] == NULL || parts[1] == NULL) { g_warning("string [%s] not parseable", log_opt); continue; } level = qof_log_level_from_string(parts[1]); qof_log_set_level(parts[0], level); g_strfreev(parts); } } }
static gboolean try_load_config_array(const gchar *fns[]) { gchar *filename; int i; for (i = 0; fns[i]; i++) { filename = gnc_build_dotgnucash_path(fns[i]); if (gfec_try_load(filename)) { g_free(filename); return TRUE; } g_free(filename); } return FALSE; }
static gchar * gnc_exp_parser_filname (void) { return gnc_build_dotgnucash_path("expressions-2.0"); }