From ad260a03706e7ad589430911448285dceafe5370 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Tue, 20 Oct 2009 19:09:12 +0000 Subject: basename() function, at least know it should compile. Feel free to replace with the proper WIN32 code. --- source/blender/blenlib/BLI_winstuff.h | 1 + source/blender/blenlib/intern/BLI_bfile.c | 2 +- source/blender/blenlib/intern/winstuff.c | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) 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 #include +// #include #else #include #include "BLI_winstuff.h" @@ -36,7 +37,6 @@ #include #include #include -#include #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 +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 */ -- cgit v1.2.3