libobs: Fix issue with getting the module data dir

When getting a blank module data file (indicating you want to get the
path to the module data directory itself), on certain operating systems
(windows) it will fail if you end the path with '/' or '\'.  So simply
make sure that if a blank module sub-path is used, don't try to append a
slash.
This commit is contained in:
jp9000 2015-08-16 13:38:25 -07:00
parent d5ebe48180
commit 6bd4f27fe9

View File

@ -151,11 +151,14 @@ char *obs_find_module_file(obs_module_t *module, const char *file)
{
struct dstr output = {0};
if (!file)
file = "";
if (!module)
return NULL;
dstr_copy(&output, module->data_path);
if (!dstr_is_empty(&output) && dstr_end(&output) != '/')
if (!dstr_is_empty(&output) && dstr_end(&output) != '/' && *file)
dstr_cat_ch(&output, '/');
dstr_cat(&output, file);