Revision: 42320
http://brlcad.svn.sourceforge.net/brlcad/?rev=42320&view=rev
Author: starseeker
Date: 2011-01-16 16:44:15 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Have bu_brlcad_root take advantage of realpath - bu_getprogname returns no path
information now, and so is almost completely useless for this purpose. This
needs more testing and may not be the final 'approved' way to get this working,
so it's only going into CMake branch for now, but it works in every case tried
so far for both installed and build dir.
Modified Paths:
--------------
brlcad/branches/cmake/src/libbu/brlcad_path.c
Modified: brlcad/branches/cmake/src/libbu/brlcad_path.c
===================================================================
--- brlcad/branches/cmake/src/libbu/brlcad_path.c 2011-01-16 08:28:19 UTC
(rev 42319)
+++ brlcad/branches/cmake/src/libbu/brlcad_path.c 2011-01-16 16:44:15 UTC
(rev 42320)
@@ -392,6 +392,7 @@
{
static char result[MAXPATHLEN] = {0};
const char *lhs;
+ char real_path[MAXPATHLEN] = {0};
struct bu_vls searched;
char where[MAX_WHERE_SIZE] = {0};
@@ -436,25 +437,10 @@
#endif
/* run-time path identification */
- lhs = bu_getprogname();
+ realpath(bu_argv0_full_path(), real_path);
+ lhs = (const char *)bu_dirname((const char *)bu_dirname(real_path));
if (lhs) {
- char argv0[MAX_WHERE_SIZE] = {0};
- size_t len = strlen(lhs);
- snprintf(argv0, MAX_WHERE_SIZE, "%s", lhs);
-
- /* need to trim off the trailing binary */
- while (len-1 > 0) {
- if (argv0[len-1] == BU_DIR_SEPARATOR) {
- argv0[len] = '.';
- argv0[len+1] = '.';
- argv0[len+2] = '\0';
- break;
- }
- len--;
- }
-
- snprintf(where, MAX_WHERE_SIZE, "\trun-time path identification
[%s]\n", argv0);
- if (_bu_find_path(result, argv0, rhs, &searched, where)) {
+ if (_bu_find_path(result, lhs, rhs, &searched, where)) {
if (UNLIKELY(bu_debug & BU_DEBUG_PATHS)) {
bu_log("Found: Run-time path identification [%s]\n", result);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits