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:
authorCampbell Barton <ideasman42@gmail.com>2014-01-30 20:28:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-30 20:30:05 +0400
commit0e1c1b61960ba520cc624ed7bd769aa524ecc1db (patch)
tree4069de15d3494e5546f690da7c0002a03bd6abd3
parent3c86a1932f848f694ba3a88bb1af35325f3f89a2 (diff)
Code cleanup: remove BLI_has_parent
-rw-r--r--source/blender/blenlib/BLI_path_util.h3
-rw-r--r--source/blender/blenlib/intern/path_util.c21
-rw-r--r--source/blender/editors/space_file/file_ops.c3
3 files changed, 2 insertions, 25 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 2b06b8b9bb4..2a4efd196b6 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -145,9 +145,6 @@ void BLI_cleanup_path(const char *relabase, char *path) ATTR_NONNULL(2);
/* go back one directory */
bool BLI_parent_dir(char *path) ATTR_NONNULL();
-/* return whether directory is root and thus has no parent dir */
-bool BLI_has_parent(char *path);
-
/**
* Blender's path code replacement function.
* Bases \a path strings leading with "//" by the
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 58ff67aa612..e56ac6f7d83 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -576,31 +576,12 @@ void BLI_path_rel(char *file, const char *relfile)
}
/**
- * Cleans path and makes sure it ends with a slash.
- * \return true if \a path has more than one other path separator in it.
- */
-bool BLI_has_parent(char *path)
-{
- int len;
- int slashes = 0;
- BLI_clean(path);
- len = BLI_add_slash(path) - 1;
-
- while (len >= 0) {
- if ((path[len] == '\\') || (path[len] == '/'))
- slashes++;
- len--;
- }
- return slashes > 1;
-}
-
-/**
* Replaces path with the path of its parent directory, returning true if
* it was able to find a parent directory within the pathname.
*/
bool BLI_parent_dir(char *path)
{
- static char parent_dir[] = {'.', '.', SEP, '\0'}; /* "../" or "..\\" */
+ const char parent_dir[] = {'.', '.', SEP, '\0'}; /* "../" or "..\\" */
char tmp[FILE_MAX + 4];
BLI_join_dirfile(tmp, sizeof(tmp), path, parent_dir);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 3d5ae8c26cf..523383a8955 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -849,8 +849,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile->params) {
- if (BLI_has_parent(sfile->params->dir)) {
- BLI_parent_dir(sfile->params->dir);
+ if (BLI_parent_dir(sfile->params->dir)) {
BLI_cleanup_dir(G.main->name, sfile->params->dir);
file_change_dir(C, 0);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);