minor bugfix [#24085] NULL character is last
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Oct 2010 13:30:09 +0000 (13:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Oct 2010 13:30:09 +0000 (13:30 +0000)
so "blah.blend" comes before "blah 1.blend"

source/blender/blenlib/intern/string.c

index 76193ba9a136a314c94ee4309ec838d8b23b4fa1..6afc34ba630eddff7825c5615e4f479952d5a6bd 100644 (file)
@@ -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;