diff options
author | Guillermo S. Romero <gsr.b3d@infernal-iceberg.com> | 2009-10-20 23:09:12 +0400 |
---|---|---|
committer | Guillermo S. Romero <gsr.b3d@infernal-iceberg.com> | 2009-10-20 23:09:12 +0400 |
commit | ad260a03706e7ad589430911448285dceafe5370 (patch) | |
tree | d5aa62caa644be1bfb7790ae19c8986468a3bbaa /source/blender/blenlib/intern/winstuff.c | |
parent | d8ee1e27375b475e610bc04f2c7cf3efee0d6c1b (diff) |
basename() function, at least know it should compile.
Feel free to replace with the proper WIN32 code.
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 26 |
1 files changed, 26 insertions, 0 deletions
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 */ |