// No DLL found
if (! dllhandle)
- return false;
+ {
+ // see if the names can be loaded relative to the executable path
+ // (this is for Mac OSX which does not check next to the executable)
+ if (strrchr(com_argv[0], '/'))
+ {
+ char path[MAX_OSPATH];
+ strlcpy(path, com_argv[0], sizeof(path));
+ *(strrchr(com_argv[0], '/')) = 0;
+ for (i = 0; dllnames[i] != NULL; i++)
+ {
+ char temp[MAX_OSPATH];
+ strlcpy(temp, path, sizeof(temp));
+ strlcat(temp, dllnames[i], sizeof(temp));
+#ifdef WIN32
+ dllhandle = LoadLibrary (temp);
+#else
+ dllhandle = dlopen (temp, RTLD_LAZY);
+#endif
+ if (dllhandle)
+ break;
+
+ Con_Printf ("Can't load \"%s\".\n", temp);
+ }
+ if (! dllhandle)
+ return false;
+ }
+ else
+ return false;
+ }
Con_Printf("\"%s\" loaded.\n", dllnames[i]);