FS-5188 --resolve Allow full path to grammar in mod_pocketsphinx
This commit is contained in:
parent
424738e9c5
commit
e917202d5e
|
@ -125,7 +125,12 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_is_file_path(grammar)) {
|
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 {
|
} else {
|
||||||
jsgf = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
|
jsgf = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue