Browse Source

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.
jp9000 10 years ago
parent
commit
6bd4f27fe9
1 changed files with 4 additions and 1 deletions
  1. 4 1
      libobs/obs-module.c

+ 4 - 1
libobs/obs-module.c

@@ -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);