diff options
Diffstat (limited to 'source/blender/blenlib/intern/util.c')
-rw-r--r-- | source/blender/blenlib/intern/util.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index 9dfe9557c1b..d65fe8a476a 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1058,6 +1058,26 @@ void BLI_makestringcode(const char *relfile, char *file) } } +int BLI_parent_dir(char *path) +{ +#ifdef WIN32 + static char *parent_dir="..\\"; +#else + static char *parent_dir="../"; +#endif + char tmp[FILE_MAXDIR+FILE_MAXFILE+4]; + BLI_strncpy(tmp, path, sizeof(tmp)); + BLI_add_slash(tmp); + strcat(tmp, parent_dir); + BLI_cleanup_dir(NULL, tmp); + + if (!BLI_testextensie(tmp, parent_dir)) { + BLI_strncpy(path, tmp, sizeof(tmp)); + return 1; + } else { + return 0; + } +} int BLI_convertstringframe(char *path, int frame) { |