Revision: 42426
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42426&view=rev
Author:   starseeker
Date:     2011-01-19 00:52:34 +0000 (Wed, 19 Jan 2011)

Log Message:
-----------
Don't hardcode '/' into bu_dirname, it's wrong on Windows

Modified Paths:
--------------
    brlcad/branches/cmake/src/libbu/dirname.c

Modified: brlcad/branches/cmake/src/libbu/dirname.c
===================================================================
--- brlcad/branches/cmake/src/libbu/dirname.c   2011-01-19 00:11:13 UTC (rev 
42425)
+++ brlcad/branches/cmake/src/libbu/dirname.c   2011-01-19 00:52:34 UTC (rev 
42426)
@@ -31,17 +31,17 @@
     char *ret;
     char *slash;
     size_t len;
-    const char *SLASH = "/";
+    char SLASH = BU_DIR_SEPARATOR;
     const char *DOT = ".";
     const char *DOTDOT = "..";
 
     /* Special cases */
     if (cp == NULL)  return bu_strdup(".");
-    if (BU_STR_EQUAL(cp, SLASH))
-       return bu_strdup(SLASH);
+    if (BU_STR_EQUAL(cp, &SLASH))
+       return bu_strdup(&SLASH);
     if (BU_STR_EQUAL(cp, DOT) ||
        BU_STR_EQUAL(cp, DOTDOT) ||
-       strrchr(cp, '/') == NULL)
+       strrchr(cp, SLASH) == NULL)
        return bu_strdup(DOT);
 
     /* Make a duplicate copy of the string, and shorten it in place */
@@ -49,10 +49,10 @@
 
     /* A trailing slash doesn't count */
     len = strlen(ret);
-    if (ret[len-1] == '/')  ret[len-1] = '\0';
+    if (ret[len-1] == SLASH)  ret[len-1] = '\0';
 
     /* If no slashes remain, return "." */
-    if ((slash = strrchr(ret, '/')) == NULL) {
+    if ((slash = strrchr(ret, SLASH)) == NULL) {
        bu_free(ret, "bu_dirname");
        return bu_strdup(DOT);
     }


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

Reply via email to