]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5188 --resolve Allow full path to grammar in mod_pocketsphinx
authorChristopher Rienzo <chris@rienzo.net>
Fri, 15 Mar 2013 23:53:13 +0000 (19:53 -0400)
committerChristopher Rienzo <chris@rienzo.net>
Fri, 15 Mar 2013 23:53:13 +0000 (19:53 -0400)
src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c

index 995fe737d2f988606f6ef4bd92d55b343a616c64..27300119679dfc77e4fcae8d493fa976f0dc6d08 100644 (file)
@@ -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);
        }