Bug fix 2047

FileWindow didnt sort the dirs "." and ".." correctly. Now these two are
always first.
This commit is contained in:
Ton Roosendaal
2005-01-03 14:17:33 +00:00
parent 5d7c2c96ea
commit 7e1fcb5c07
2 changed files with 23 additions and 4 deletions

View File

@@ -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));
}

View File

@@ -312,6 +312,12 @@ static int compare_name(const void *a1, const void *a2)
}
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));
}
@@ -334,12 +340,14 @@ static int compare_date(const void *a1, const void *a2)
if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
/*
if ( entry1->s.st_ctime < entry2->s.st_ctime) return 1;
if ( entry1->s.st_ctime > entry2->s.st_ctime) 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);
if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
else return strcasecmp(entry1->relname,entry2->relname);
}
@@ -362,6 +370,11 @@ static int compare_size(const void *a1, const void *a2)
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);
if ( entry1->s.st_size < entry2->s.st_size) return 1;
if ( entry1->s.st_size > entry2->s.st_size) return -1;
else return strcasecmp(entry1->relname,entry2->relname);