diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_storage_types.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 13 |
4 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_storage_types.h b/source/blender/blenlib/BLI_storage_types.h index 36d96f6075c..9ae7527253e 100644 --- a/source/blender/blenlib/BLI_storage_types.h +++ b/source/blender/blenlib/BLI_storage_types.h @@ -55,6 +55,7 @@ struct direntry{ char *string; mode_t type; char *relname; + char *path; #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500) struct _stat64 s; #else diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index fb345de72e9..5ee97ff516b 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -66,6 +66,14 @@ char *BLI_strdupn(const char *str, int len); * the size of dst) * @retval Returns dst */ +char *BLI_strdupcat(const char *str1, const char *str2); + + /** + * Appends the two strings, and returns new mallocN'ed string + * @param str1 first string for copy + * @param str2 second string for append + * @retval Returns dst + */ char *BLI_strncpy(char *dst, const char *src, int maxncpy); /* Makes a copy of the text within the "" that appear after some text 'blahblah' diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 09bca168e64..ee7734fb14b 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -261,6 +261,7 @@ void BLI_builddir(char *dirname, char *relname) while(dlink){ memset(&files[actnum], 0 , sizeof(struct direntry)); files[actnum].relname = dlink->name; + files[actnum].path = BLI_strdupcat(dirname, dlink->name); // use 64 bit file size, only needed for WIN32 and WIN64. // Excluding other than current MSVC compiler until able to test. #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500) diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 405f8c6db97..e60209281a7 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -54,6 +54,19 @@ char *BLI_strdup(const char *str) { return BLI_strdupn(str, strlen(str)); } +char *BLI_strdupcat(const char *str1, const char *str2) +{ + int len; + char *n; + + len= strlen(str1)+strlen(str2); + n= MEM_mallocN(len+1, "strdupcat"); + strcpy(n, str1); + strcat(n, str2); + + return n; +} + char *BLI_strncpy(char *dst, const char *src, int maxncpy) { int srclen= strlen(src); int cpylen= (srclen>(maxncpy-1))?(maxncpy-1):srclen; |