[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59614] trunk/blender/source/blender/ editors/space_file/filelist.c: Fix #36595: file browser sorting with link/ append would mix together .blend files
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Aug 28 23:50:14 CEST 2013
Revision: 59614
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59614
Author: blendix
Date: 2013-08-28 21:50:13 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
Fix #36595: file browser sorting with link/append would mix together .blend files
and directories instead of keeping them separate like regular file browse.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_file/filelist.c
Modified: trunk/blender/source/blender/editors/space_file/filelist.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.c 2013-08-28 19:40:16 UTC (rev 59613)
+++ trunk/blender/source/blender/editors/space_file/filelist.c 2013-08-28 21:50:13 UTC (rev 59614)
@@ -152,17 +152,27 @@
/* ******************* SORT ******************* */
+static bool compare_is_directory(const struct direntry *entry)
+{
+ /* for library browse .blend files may be treated as directories, but
+ * for sorting purposes they should be considered regular files */
+ if (S_ISDIR(entry->type))
+ return !(entry->flags & (BLENDERFILE|BLENDERFILE_BACKUP));
+
+ return false;
+}
+
static int compare_name(const void *a1, const void *a2)
{
const struct direntry *entry1 = a1, *entry2 = a2;
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type) == 0) return (-1);
+ if (compare_is_directory(entry1)) {
+ if (compare_is_directory(entry2) == 0) return (-1);
}
else {
- if (S_ISDIR(entry2->type)) return (1);
+ if (compare_is_directory(entry2)) return (1);
}
if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type) == 0) return (-1);
@@ -188,11 +198,11 @@
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type) == 0) return (-1);
+ if (compare_is_directory(entry1)) {
+ if (compare_is_directory(entry2) == 0) return (-1);
}
else {
- if (S_ISDIR(entry2->type)) return (1);
+ if (compare_is_directory(entry2)) return (1);
}
if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type) == 0) return (-1);
@@ -221,11 +231,11 @@
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type) == 0) return (-1);
+ if (compare_is_directory(entry1)) {
+ if (compare_is_directory(entry2) == 0) return (-1);
}
else {
- if (S_ISDIR(entry2->type)) return (1);
+ if (compare_is_directory(entry2)) return (1);
}
if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type) == 0) return (-1);
@@ -262,11 +272,11 @@
/* type is equal to stat.st_mode */
- if (S_ISDIR(entry1->type)) {
- if (S_ISDIR(entry2->type) == 0) return (-1);
+ if (compare_is_directory(entry1)) {
+ if (compare_is_directory(entry2) == 0) return (-1);
}
else {
- if (S_ISDIR(entry2->type)) return (1);
+ if (compare_is_directory(entry2)) return (1);
}
if (S_ISREG(entry1->type)) {
if (S_ISREG(entry2->type) == 0) return (-1);
More information about the Bf-blender-cvs
mailing list