Revision: 14607
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14607
Author:   campbellbarton
Date:     2008-04-28 23:29:15 +0200 (Mon, 28 Apr 2008)

Log Message:
-----------
if a blend file was opened with /./ in the path (for example 
"some/./path/to/./model.blend" ) the relative paths from created from that 
location would be incorrect. This results in linked library paths being loaded 
incorrectly.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/util.c

Modified: trunk/blender/source/blender/blenlib/intern/util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/util.c  2008-04-28 20:57:03 UTC 
(rev 14606)
+++ trunk/blender/source/blender/blenlib/intern/util.c  2008-04-28 21:29:15 UTC 
(rev 14607)
@@ -858,6 +858,8 @@
  * take the dir name, make it absolute, and clean it up, replacing
  * excess file entry stuff (like /tmp/../tmp/../)
  * note that dir isn't protected for max string names... 
+ * 
+ * If relbase is NULL then its ignored
  */
 
 void BLI_cleanup_dir(const char *relabase, char *dir)
@@ -874,9 +876,9 @@
 {
        short a;
        char *start, *eind;
-       
-       BLI_convertstringcode(dir, relabase, 0);
-       
+       if (relabase) {
+               BLI_convertstringcode(dir, relabase, 0);
+       }
 #ifdef WIN32
        if(dir[0]=='.') {       /* happens for example in FILE_MAIN */
           get_default_root(dir);
@@ -954,7 +956,7 @@
        char * lslash;
        char temp[FILE_MAXDIR+FILE_MAXFILE];
        char res[FILE_MAXDIR+FILE_MAXFILE];
-
+       
        /* if file is already relative, bail out */
        if(file[0]=='/' && file[1]=='/') return;
        
@@ -986,7 +988,11 @@
 
        BLI_char_switch(temp, '\\', '/');
        BLI_char_switch(file, '\\', '/');
-
+       
+       /* remove /./ which confuse the following slash counting... */
+       BLI_cleanup_file(NULL, file);
+       BLI_cleanup_file(NULL, temp);
+       
        /* the last slash in the file indicates where the path part ends */
        lslash = BLI_last_slash(temp);
 
@@ -1065,6 +1071,8 @@
 
        BLI_strncpy(base, basepath, FILE_MAX);
        
+       BLI_cleanup_file(NULL, base);
+       
        /* push slashes into unix mode - strings entering this part are
           potentially messed up: having both back- and forward slashes.
           Here we push into one conform direction, and at the end we
@@ -1147,7 +1155,7 @@
        */
        BLI_char_switch(path+2, '/', '\\');
 #endif
-
+       
        return wasrelative;
 }
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to