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
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r--source/blender/blenlib/intern/path_util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 454663df1ae..85d18d99f96 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1109,6 +1109,24 @@ int BLI_testextensie(const char *str, const char *ext)
return (retval);
}
+int BLI_replace_extension(char *path, int maxlen, const char *ext)
+{
+ int a;
+
+ for(a=strlen(path)-1; a>=0; a--)
+ if(path[a] == '.' || path[a] == '/' || path[a] == '\\')
+ break;
+
+ if(path[a] != '.')
+ a= strlen(path);
+
+ if(a + strlen(ext) >= maxlen)
+ return 0;
+
+ strcpy(path+a, ext);
+ return 1;
+}
+
/* Converts "/foo/bar.txt" to "/foo/" and "bar.txt"
* - wont change 'string'
* - wont create any directories