[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35463] trunk/blender/source/blender/ blenlib/intern/path_util.c: simplify BLI_path_abs by using BLI_cleanup_path

Campbell Barton ideasman42 at gmail.com
Fri Mar 11 02:06:17 CET 2011


Revision: 35463
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35463
Author:   campbellbarton
Date:     2011-03-11 01:06:16 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
simplify BLI_path_abs by using BLI_cleanup_path

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

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2011-03-11 00:30:51 UTC (rev 35462)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2011-03-11 01:06:16 UTC (rev 35463)
@@ -677,9 +677,10 @@
 #endif
 
 	BLI_strncpy(base, basepath, sizeof(base));
+
+	/* file component is ignored, so dont bother with the trailing slash */
+	BLI_cleanup_path(NULL, base);
 	
-	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
@@ -707,17 +708,9 @@
 	} else {
 		BLI_strncpy(path, tmp, FILE_MAX);
 	}
-	
-	if (path[0]!='\0') {
-		if ( path[strlen(path)-1]=='/') {
-			/* remove the '/' so we avoid BLI_cleanup_dir adding an extra \ in WIN32 */
-			path[strlen(path)-1] = '\0';
-			BLI_cleanup_dir(NULL, path);
-		} else {
-			BLI_cleanup_file(NULL, path);
-		}
-	}
-	
+
+	BLI_cleanup_path(NULL, path);
+
 #ifdef WIN32
 	/* skip first two chars, which in case of
 	   absolute path will be drive:/blabla and




More information about the Bf-blender-cvs mailing list