[Bf-blender-cvs] [956d8e0] asset-experiments: Fix for Windows - 'foobar.blend\' is a valid file path to that OS, sigh...

Bastien Montagne noreply at git.blender.org
Sat Jan 17 20:15:53 CET 2015


Commit: 956d8e0ddd85541222bb4f9dc78c5e40f5c66799
Author: Bastien Montagne
Date:   Sat Jan 17 20:08:12 2015 +0100
Branches: asset-experiments
https://developer.blender.org/rB956d8e0ddd85541222bb4f9dc78c5e40f5c66799

Fix for Windows - 'foobar.blend\' is a valid file path to that OS, sigh...

Also, store temp nullified pathsep in chars now, better.

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 581a6dc..32e3b74 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1150,7 +1150,7 @@ bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, cha
 {
 	/* We might get some data names with slashes, so we have to go up in path until we find blend file itself,
 	 * then we now next path item is group, and everything else is data name. */
-	char *slash = NULL, *prev_slash = NULL;
+	char *slash = NULL, *prev_slash = NULL, c = '\0';
 
 	r_dir[0] = '\0';
 	if (r_group) {
@@ -1160,23 +1160,25 @@ bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, cha
 		*r_name = NULL;
 	}
 
-	/* if path leads to an existing directory or file, we can be sure we're not in a library */
-	if (BLI_is_dir(path) || BLI_is_file(path)) {
+	/* if path leads to an existing directory, we can be sure we're not (in) a library */
+	if (BLI_is_dir(path)) {
 		return false;
 	}
 
 	strcpy(r_dir, path);
 
 	while ((slash = (char *)BLI_last_slash(r_dir))) {
+		char tc = *slash;
 		*slash = '\0';
 		if (BLO_has_bfile_extension(r_dir)) {
 			break;
 		}
 
 		if (prev_slash) {
-			*prev_slash = SEP;
+			*prev_slash = c;
 		}
 		prev_slash = slash;
+		c = tc;
 	}
 
 	if (!slash) {




More information about the Bf-blender-cvs mailing list