From: Christopher Rienzo Date: Fri, 15 Mar 2013 23:53:13 +0000 (-0400) Subject: FS-5188 --resolve Allow full path to grammar in mod_pocketsphinx X-Git-Tag: v1.3.17-final~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e917202d5ec1f59b7fe0775b5038d22cdd7d5111;p=thirdparty%2Ffreeswitch.git FS-5188 --resolve Allow full path to grammar in mod_pocketsphinx --- diff --git a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c index 995fe737d2..2730011967 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +++ b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c @@ -125,7 +125,12 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co } if (switch_is_file_path(grammar)) { - jsgf = switch_mprintf("%s.gram", grammar); + char *dot = strrchr(grammar, '.'); + if (dot && !strcmp(dot, ".gram")) { + jsgf = strdup(grammar); + } else { + jsgf = switch_mprintf("%s.gram", grammar); + } } else { jsgf = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar); }