Revision: 77332
http://sourceforge.net/p/brlcad/code/77332
Author: brlcad
Date: 2020-10-05 14:32:19 +0000 (Mon, 05 Oct 2020)
Log Message:
-----------
cal bu_dir() to build up our path so we can build up an appropriate path into
the libdir. also lets us specify a proper library suffix.
Modified Paths:
--------------
brlcad/trunk/src/liboptical/material.c
Modified: brlcad/trunk/src/liboptical/material.c
===================================================================
--- brlcad/trunk/src/liboptical/material.c 2020-10-05 14:20:07 UTC (rev
77331)
+++ brlcad/trunk/src/liboptical/material.c 2020-10-05 14:32:19 UTC (rev
77332)
@@ -153,43 +153,49 @@
/* Look in the current working directory for {sh_name}.so */
snprintf(libname, sizeof(libname), "%s/%s.so", cwd, sh_name);
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
/* Look in the current working directory for lib{sh_name}.so */
snprintf(libname, sizeof(libname), "%s/lib%s.so", cwd, sh_name);
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
- /* Look in the location indicated by $LD_LIBRARY_PATH for
- * {sh_name}.so
+ /* Don't specify a path in order to look in the location indicated
+ * by ld (e.g., $LD_LIBRARY_PATH) for {sh_name}.so
*/
snprintf(libname, sizeof(libname), "%s.so", sh_name);
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
- /* Look in the location indicated by $LD_LIBRARY_PATH for
- * lib{sh_name}.so
+ /* Don't specify a path in order to look in the location indicated
+ * by ld (e.g., $LD_LIBRARY_PATH) for lib{sh_name}.so
*/
snprintf(libname, sizeof(libname), "lib%s.so", sh_name);
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
- /* Look in BRL-CAD install dir under lib dir for lib{sh_name}.so */
- snprintf(libpath, sizeof(libpath), "/lib/%s.so", sh_name);
- bu_strlcpy(libname, bu_brlcad_root(libpath, 1), sizeof(libname));
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ /* Look in BRL-CAD install dir under lib dir for {sh_name}.so */
+ bu_dir(libpath, sizeof(libpath), BU_DIR_LIB, sh_name, BU_DIR_LIBEXT, NULL);
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
/* Look in BRL-CAD install dir under lib dir for lib{sh_name}.so */
- snprintf(libpath, sizeof(libpath), "/lib/lib%s.so", sh_name);
- bu_strlcpy(libname, bu_brlcad_root(libpath, 1), sizeof(libname));
- if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ snprintf(libpath, sizeof(libpath), "lib%s.so", sh_name);
+ bu_dir(libpath, sizeof(libpath), BU_DIR_LIB, libpath, BU_DIR_LIBEXT, NULL);
+ shader_mfuncs = try_load(libname, material, sh_name);
+ if (shader_mfuncs)
goto done;
done:
/* clean up memory allocated */
- if (cwd) free(cwd);
+ if (cwd)
+ free(cwd);
/* print appropriate log messages */
if (shader_mfuncs)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits