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:
authorTon Roosendaal <ton@blender.org>2005-01-03 17:17:33 +0300
committerTon Roosendaal <ton@blender.org>2005-01-03 17:17:33 +0300
commit7e1fcb5c07eddbd8a1cd3247bb4e6f25c0efb84f (patch)
tree8b0e27ba1b0e8e9ec45bc236d5e727d88277d96d /source/blender/blenlib/intern/storage.c
parent5d7c2c96ea092db6623526cf8e90c41b3ea9c3de (diff)
Bug fix 2047
FileWindow didnt sort the dirs "." and ".." correctly. Now these two are always first.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r--source/blender/blenlib/intern/storage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 4982ffa5899..8a4db10c843 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -152,6 +152,12 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2)
}
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
+
+ /* make sure "." and ".." are always first */
+ if( strcmp(entry1->relname, ".")==0 ) return (-1);
+ if( strcmp(entry2->relname, ".")==0 ) return (1);
+ if( strcmp(entry1->relname, "..")==0 ) return (-1);
+
return (strcasecmp(entry1->relname,entry2->relname));
}