diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-01 17:30:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-01 17:30:09 +0400 |
commit | efb98f249980aa2977e0fd29baf45ca56b42a154 (patch) | |
tree | e7c38958d0f0a76c6fa25a3a7b8a30150646351b /source/blender/blenlib/intern/string.c | |
parent | 2e44e06450d334503771626c647c03c99e4671a0 (diff) |
minor bugfix [#24085] NULL character is last
so "blah.blend" comes before "blah 1.blend"
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 76193ba9a13..6afc34ba630 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -311,8 +311,13 @@ int BLI_natstrcmp(const char *s1, const char *s2) c1 = tolower(s1[d1]); c2 = tolower(s2[d2]); } - - if (c1<c2) { + + /* first check for '.' so "foo.bar" comes before "foo 1.bar" */ + if(c1=='.' && c2!='.') + return -1; + if(c1!='.' && c2=='.') + return 1; + else if (c1<c2) { return -1; } else if (c1>c2) { return 1; |