TEST_FIXTURE(EnchantGetPrefixDirTestFixture, EnchantGetPrefixDir) { char* prefixDir = enchant_get_prefix_dir(); CHECK_EQUAL(ExpectedPrefixDir(), prefixDir); g_free(prefixDir); }
TEST_FIXTURE(EnchantGetPrefixDirTestFixture, EnchantGetPrefixDir) { char* prefixDir = enchant_get_prefix_dir(); const char* expectedPrefixDir = ExpectedPrefixDir(); fprintf(stderr, "prefixDir: %s, expectedPrefixDir: %s\n", prefixDir, expectedPrefixDir); CHECK((expectedPrefixDir == NULL && prefixDir == NULL) || strcmp(expectedPrefixDir, prefixDir) == 0); g_free(prefixDir); }
static GSList * ispell_checker_get_dictionary_dirs (void) { GSList *dirs = NULL; { GSList *config_dirs, *iter; config_dirs = enchant_get_user_config_dirs (); for (iter = config_dirs; iter; iter = iter->next) { dirs = g_slist_append (dirs, g_build_filename ((const gchar *)iter->data, ENCHANT_ISPELL_HOME_DIR, NULL)); } g_slist_foreach (config_dirs, (GFunc)g_free, NULL); g_slist_free (config_dirs); } /* until I work out how to link the modules against enchant in MacOSX - fjf */ #ifndef XP_TARGET_COCOA char * ispell_prefix = NULL; /* Look for explicitly set registry values */ ispell_prefix = enchant_get_registry_value ("Ispell", "Data_Dir"); if (ispell_prefix) dirs = g_slist_append (dirs, ispell_prefix); /* Dynamically locate library and search for modules relative to it. */ char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { ispell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "ispell", NULL); g_free(enchant_prefix); dirs = g_slist_append (dirs, ispell_prefix); } #endif #ifdef ENCHANT_ISPELL_DICT_DIR dirs = g_slist_append (dirs, g_strdup (ENCHANT_ISPELL_DICT_DIR)); #endif return dirs; }
static GSList * uspell_checker_get_dictionary_dirs (EnchantBroker * broker) { GSList *dirs = NULL; { GSList *config_dirs, *iter; config_dirs = enchant_get_user_config_dirs (); for (iter = config_dirs; iter; iter = iter->next) { dirs = g_slist_append (dirs, g_build_filename ((const gchar *)iter->data, "uspell", NULL)); } g_slist_foreach (config_dirs, (GFunc)g_free, NULL); g_slist_free (config_dirs); } { const gchar* const * system_data_dirs = g_get_system_data_dirs (); const gchar* const * iter; for (iter = system_data_dirs; *iter; iter++) { dirs = g_slist_append (dirs, g_build_filename (*iter, "uspell", "dicts", NULL)); } } /* until I work out how to link the modules against enchant in MacOSX - fjf */ #ifndef XP_TARGET_COCOA char * uspell_prefix = NULL; /* Look for explicitly set registry values */ uspell_prefix = enchant_get_registry_value ("Uspell", "Data_Dir"); if (uspell_prefix) dirs = g_slist_append (dirs, uspell_prefix); /* Dynamically locate library and search for modules relative to it. */ char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { uspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "uspell", NULL); g_free(enchant_prefix); dirs = g_slist_append (dirs, uspell_prefix); } #endif #ifdef ENCHANT_USPELL_DICT_DIR dirs = g_slist_append (dirs, g_strdup (ENCHANT_USPELL_DICT_DIR)); #endif { GSList *config_dirs, *iter; config_dirs = enchant_get_dirs_from_param (broker, "enchant.uspell.dictionary.path"); for (iter = config_dirs; iter; iter = iter->next) { dirs = g_slist_append (dirs, g_strdup ((const gchar *)iter->data)); } g_slist_foreach (config_dirs, (GFunc)g_free, NULL); g_slist_free (config_dirs); } return dirs; }