diff options
author | Dom Lachowicz <domlachowicz@gmail.com> | 2009-05-22 21:44:15 +0000 |
---|---|---|
committer | Dom Lachowicz <domlachowicz@gmail.com> | 2009-05-22 21:44:15 +0000 |
commit | 08a58f0a699bc82c77243b986f50536660538a5f (patch) | |
tree | e95bf7cd7953231d7969de570c54064e9c5c177a /src/enchant.c | |
parent | 2f830e3bb302e45c5ffb4070f10a2b3e66407315 (diff) | |
download | enchant-08a58f0a699bc82c77243b986f50536660538a5f.tar.gz |
code should parse a parameter and turn it into a list of paths. normal win32/posix path conventions apply. i.e. on windows, use a semi-colon to separate paths, and on posix, use a colon
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@26484 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
Diffstat (limited to 'src/enchant.c')
-rw-r--r-- | src/enchant.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/enchant.c b/src/enchant.c index 9429c91..3410be7 100644 --- a/src/enchant.c +++ b/src/enchant.c @@ -2286,5 +2286,29 @@ enchant_broker_set_param (EnchantBroker * broker, const char * const param_name, ENCHANT_MODULE_EXPORT (GSList *) enchant_get_dirs_from_param (EnchantBroker * broker, const char * const param_name) { - return NULL; + const char *param_value; + char **tokens; + GSList *dirs = NULL; + + param_value = enchant_broker_get_param (broker, param_name); + if (param_value == NULL) + return NULL; + +#ifdef _WIN32 + tokens = g_strsplit (param_value, ";", 0); +#else + tokens = g_strsplit (param_value, ":", 0); +#endif + if (tokens != NULL) { + int i; + for (i = 0; tokens[i]; i++) + { + char *token = g_strstrip(tokens[i]); + dirs = g_slist_append (dirs, g_strdup (token)); + } + + g_strfreev (tokens); + } + + return dirs; } |