@@ -25,7 +25,7 @@ var cmpDirLast fnCompareDir = func(prev, next os.FileInfo) (less, ok bool) {
25
25
prevIsDir := prev .IsDir ()
26
26
nextIsDir := next .IsDir ()
27
27
if prevIsDir != nextIsDir {
28
- return ! prevIsDir , true
28
+ return nextIsDir , true
29
29
}
30
30
return true , false
31
31
}
@@ -232,9 +232,9 @@ func (infos infosSizeAsc) Less(i, j int) bool {
232
232
return items [i ].Size () < items [j ].Size ()
233
233
}
234
234
235
- cmpResult := strings . Compare ( items [i ].Name (), items [j ].Name ())
236
- if cmpResult != 0 {
237
- return cmpResult < 0
235
+ less , ok = util . CompareNumInFilename ([] byte ( items [i ].Name ()), [] byte ( items [j ].Name () ))
236
+ if ok {
237
+ return less
238
238
}
239
239
240
240
return i < j
@@ -262,9 +262,9 @@ func (infos infosSizeDesc) Less(i, j int) bool {
262
262
return items [j ].Size () < items [i ].Size ()
263
263
}
264
264
265
- cmpResult := strings . Compare ( items [j ].Name (), items [i ].Name ())
266
- if cmpResult != 0 {
267
- return cmpResult < 0
265
+ less , ok = util . CompareNumInFilename ([] byte ( items [j ].Name ()), [] byte ( items [i ].Name () ))
266
+ if ok {
267
+ return less
268
268
}
269
269
270
270
return j < i
@@ -292,9 +292,9 @@ func (infos infosTimeAsc) Less(i, j int) bool {
292
292
return items [i ].ModTime ().Before (items [j ].ModTime ())
293
293
}
294
294
295
- cmpResult := strings . Compare ( items [i ].Name (), items [j ].Name ())
296
- if cmpResult != 0 {
297
- return cmpResult < 0
295
+ less , ok = util . CompareNumInFilename ([] byte ( items [i ].Name ()), [] byte ( items [j ].Name () ))
296
+ if ok {
297
+ return less
298
298
}
299
299
300
300
return i < j
@@ -322,9 +322,9 @@ func (infos infosTimeDesc) Less(i, j int) bool {
322
322
return items [j ].ModTime ().Before (items [i ].ModTime ())
323
323
}
324
324
325
- cmpResult := strings . Compare ( items [j ].Name (), items [i ].Name ())
326
- if cmpResult != 0 {
327
- return cmpResult < 0
325
+ less , ok = util . CompareNumInFilename ([] byte ( items [j ].Name ()), [] byte ( items [i ].Name () ))
326
+ if ok {
327
+ return less
328
328
}
329
329
330
330
return j < i
0 commit comments