aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-01-31 16:33:47 +0100
committerRobin Appelman <icewind@owncloud.com>2012-01-31 16:33:47 +0100
commit371b4642bb21697a06424f1440f4b90ad4e59b9d (patch)
treecc5ddf8b42ead4fbeeb6e06d23c4d4d3a6ac4707 /lib
parentf1c5dce75c5f1bc2c9d7022a8b43577a3dec9629 (diff)
downloadnextcloud-server-371b4642bb21697a06424f1440f4b90ad4e59b9d.tar.gz
nextcloud-server-371b4642bb21697a06424f1440f4b90ad4e59b9d.zip
proper file sorting
Diffstat (limited to 'lib')
-rw-r--r--lib/files.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/files.php b/lib/files.php
index 5686287ecc4..457c8ea38f2 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -41,7 +41,7 @@ class OC_Files {
$file['directory']=$directory;
$file['type']=($file['mimetype']=='httpd/unix-directory')?'dir':'file';
}
- uksort($files, "strnatcasecmp");
+ usort($files, "fileCmp");//TODO: remove this once ajax is merged
return $files;
}
@@ -290,3 +290,13 @@ class OC_Files {
return $path;
}
}
+
+function fileCmp($a,$b){
+ if($a['type']=='dir' and $b['type']!='dir'){
+ return -1;
+ }elseif($a['type']!='dir' and $b['type']=='dir'){
+ return 1;
+ }else{
+ return strnatcasecmp($a['name'],$b['name']);
+ }
+}