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
path: root/source
diff options
context:
space:
mode:
authorGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>2009-10-20 23:09:12 +0400
committerGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>2009-10-20 23:09:12 +0400
commitad260a03706e7ad589430911448285dceafe5370 (patch)
treed5aa62caa644be1bfb7790ae19c8986468a3bbaa /source
parentd8ee1e27375b475e610bc04f2c7cf3efee0d6c1b (diff)
basename() function, at least know it should compile.
Feel free to replace with the proper WIN32 code.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_winstuff.h1
-rw-r--r--source/blender/blenlib/intern/BLI_bfile.c2
-rw-r--r--source/blender/blenlib/intern/winstuff.c26
3 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index 757b3605203..77d41e2b96a 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -129,6 +129,7 @@ struct dirent *readdir(DIR *dp);
int closedir (DIR *dp);
void get_default_root(char *root);
int check_file_chars(char *filename);
+char *dirname(char *path);
#ifdef WIN32
int BLI_getInstallationDir(char *str);
diff --git a/source/blender/blenlib/intern/BLI_bfile.c b/source/blender/blenlib/intern/BLI_bfile.c
index 093168bbb82..042cf4beffc 100644
--- a/source/blender/blenlib/intern/BLI_bfile.c
+++ b/source/blender/blenlib/intern/BLI_bfile.c
@@ -29,6 +29,7 @@
#ifndef WIN32
#include <unistd.h>
#include <sys/param.h>
+// #include <libgen.h>
#else
#include <io.h>
#include "BLI_winstuff.h"
@@ -36,7 +37,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <libgen.h>
#include "MEM_guardedalloc.h"
#include "BKE_utildefines.h"
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 2f96f7b6af1..16295fc2680 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -217,6 +217,32 @@ int check_file_chars(char *filename)
return 1;
}
+/* Copied from http://sourceware.org/ml/newlib/2005/msg00248.html */
+/* Copyright 2005 Shaun Jackman
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+#include <string.h>
+char* dirname(char *path)
+{
+ char *p;
+ if( path == NULL || *path == '\0' )
+ return ".";
+ p = path + strlen(path) - 1;
+ while( *p == '/' ) {
+ if( p == path )
+ return path;
+ *p-- = '\0';
+ }
+ while( p >= path && *p != '/' )
+ p--;
+ return
+ p < path ? "." :
+ p == path ? "/" :
+ (*p = '\0', path);
+}
+/* End of copied part */
+
#else
/* intentionally empty for UNIX */