[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24015] trunk/blender/source/blender/ blenlib: basename() function, at least know it should compile.

gsr b3d gsr.b3d at infernal-iceberg.com
Tue Oct 20 21:09:13 CEST 2009


Revision: 24015
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24015
Author:   gsrb3d
Date:     2009-10-20 21:09:12 +0200 (Tue, 20 Oct 2009)

Log Message:
-----------
basename() function, at least know it should compile.
Feel free to replace with the proper WIN32 code.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_winstuff.h
    trunk/blender/source/blender/blenlib/intern/BLI_bfile.c
    trunk/blender/source/blender/blenlib/intern/winstuff.c

Modified: trunk/blender/source/blender/blenlib/BLI_winstuff.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_winstuff.h	2009-10-20 18:49:21 UTC (rev 24014)
+++ trunk/blender/source/blender/blenlib/BLI_winstuff.h	2009-10-20 19:09:12 UTC (rev 24015)
@@ -129,6 +129,7 @@
 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);

Modified: trunk/blender/source/blender/blenlib/intern/BLI_bfile.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_bfile.c	2009-10-20 18:49:21 UTC (rev 24014)
+++ trunk/blender/source/blender/blenlib/intern/BLI_bfile.c	2009-10-20 19:09:12 UTC (rev 24015)
@@ -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"

Modified: trunk/blender/source/blender/blenlib/intern/winstuff.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/winstuff.c	2009-10-20 18:49:21 UTC (rev 24014)
+++ trunk/blender/source/blender/blenlib/intern/winstuff.c	2009-10-20 19:09:12 UTC (rev 24015)
@@ -217,6 +217,32 @@
 	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 */





More information about the Bf-blender-cvs mailing list