diff options
author | Dom Lachowicz <domlachowicz@gmail.com> | 2003-09-04 00:31:54 +0000 |
---|---|---|
committer | Dom Lachowicz <domlachowicz@gmail.com> | 2003-09-04 00:31:54 +0000 |
commit | ad5d9d3b1319a1ea7eab0d4633d2eab7081ed9b4 (patch) | |
tree | 8fe519c18d8a3fe835088033f0119bc8630e44a4 | |
parent | 98e58f66ee57fb80e60235f141fb247ca6b78450 (diff) | |
download | enchant-ad5d9d3b1319a1ea7eab0d4633d2eab7081ed9b4.tar.gz |
hopefully a shortcut for aspell file existence test
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@20844 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r-- | src/aspell/aspell_provider.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/aspell/aspell_provider.c b/src/aspell/aspell_provider.c index 4c80def..c25ccc1 100644 --- a/src/aspell/aspell_provider.c +++ b/src/aspell/aspell_provider.c @@ -199,10 +199,34 @@ aspell_provider_dictionary_exists (struct str_enchant_provider * me, EnchantDict * dict; int exists = 0; - dict = aspell_provider_request_dict (me, tag); - if (dict) { - exists = 1; - aspell_provider_dispose_dict (me, dict); +#ifdef ASPELL_DICT_DIR + char * file, * ext; + + /* hack for a quick existence test */ + + ext = g_strdup_printf ("%s.multi", tag); + file = g_build_filename (ASPELL_DICT_DIR, ext); + if (g_file_test (file, G_FILE_TEST_EXISTS)) + exists = 1; + g_free (file); + g_free (ext); + + if (strlen (tag) > 2 && tag[2] == '_') { + ext = g_strdup_printf ("%c%c.multi", tag[0], tag[1]); + file = g_build_filename (ASPELL_DICT_DIR, ext); + if (g_file_test (file, G_FILE_TEST_EXISTS)) + exists = 1; + g_free (file); + g_free (ext); + } +#endif + + if (!exists) { + dict = aspell_provider_request_dict (me, tag); + if (dict) { + exists = 1; + aspell_provider_dispose_dict (me, dict); + } } return exists; |