1
0
Эх сурвалжийг харах

obs-scripting: Load obspython.py from Resources on macOS

derrod 3 жил өмнө
parent
commit
afa8527723

+ 18 - 4
deps/obs-scripting/obs-scripting-python.c

@@ -1676,10 +1676,24 @@ bool obs_scripting_load_python(const char *python_path)
 	bfree(absolute_script_path);
 
 #if __APPLE__
-	char *exec_path = os_get_executable_path_ptr("");
-	if (exec_path)
-		add_to_python_path(exec_path);
-	bfree(exec_path);
+	char *absolute_exec_path = os_get_executable_path_ptr("");
+
+	if (absolute_exec_path != NULL) {
+		add_to_python_path(absolute_exec_path);
+
+		struct dstr resources_path;
+		dstr_init_move_array(&resources_path, absolute_exec_path);
+		dstr_cat(&resources_path, "../Resources");
+
+		char *absolute_resources_path = os_get_abs_path_ptr(resources_path.array);
+		if (absolute_resources_path != NULL) {
+			add_to_python_path(absolute_resources_path);
+			bfree(absolute_resources_path);
+		}
+
+		dstr_free(&resources_path);
+		bfree(absolute_exec_path);
+	}
 #endif
 
 	py_obspython = PyImport_ImportModule("obspython");