Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-18 14:51:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-18 14:51:48 +0400
commite048a555fc8b5362befa67af00c331c45b7c866c (patch)
tree24492ad53050c9069fe8c2f4db66577d75570253 /source/blender/blenlib/intern/fileops.c
parente37ff1dd46a274d6e58e3c8ca340caec1fbf0263 (diff)
fix [#32572] Windows: False error on console when a new folder is created during a save or export operation
Diffstat (limited to 'source/blender/blenlib/intern/fileops.c')
-rw-r--r--source/blender/blenlib/intern/fileops.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index f3107b565b9..c2f0c38247a 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -341,7 +341,7 @@ void BLI_dir_create_recursive(const char *dirname)
{
char *lslash;
char tmp[MAXPATHLEN];
-
+
/* First remove possible slash at the end of the dirname.
* This routine otherwise tries to create
* blah1/blah2/ (with slash) after creating
@@ -349,23 +349,29 @@ void BLI_dir_create_recursive(const char *dirname)
BLI_strncpy(tmp, dirname, sizeof(tmp));
lslash = BLI_last_slash(tmp);
-
- if (lslash == tmp + strlen(tmp) - 1) {
- *lslash = 0;
+
+ if (lslash && (*(lslash + 1) == '\0')) {
+ *lslash = '\0';
}
-
+
+ /* check special case "c:\foo", don't try create "c:", harmless but prints an error below */
+ if (isalpha(tmp[0]) && (tmp[1] == ':') && tmp[2] == '\0') return;
+
if (BLI_exists(tmp)) return;
lslash = BLI_last_slash(tmp);
+
if (lslash) {
/* Split about the last slash and recurse */
*lslash = 0;
BLI_dir_create_recursive(tmp);
}
-
- if (dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
- if (umkdir(dirname) == -1)
+
+ if (dirname[0]) { /* patch, this recursive loop tries to create a nameless directory */
+ if (umkdir(dirname) == -1) {
printf("Unable to create directory %s\n", dirname);
+ }
+ }
}
int BLI_rename(const char *from, const char *to)