private File[] sortFiles( File[] files ) {

	TreeMap<String,File> dirMap = new TreeMap<String,File>( CaseInsensitiveComparator.sharedInstance );
	TreeMap<String,File> fileMap = new TreeMap<String,File>( CaseInsensitiveComparator.sharedInstance );
 
	for( int i = 0; i < files.length; i++ ) {

	    if( files[i].isDirectory() )
		dirMap.put( files[i].getName(), files[i] );
	    else
		fileMap.put( files[i].getName(), files[i] );

	}

	int i = 0;
	Iterator<String> dirIter = dirMap.keySet().iterator();
	while( dirIter.hasNext() ) {
	    files[i++] = dirMap.get( dirIter.next() );
	}

	Iterator<String> fileIter = fileMap.keySet().iterator();
	while( fileIter.hasNext() ) {
	    files[i++] = fileMap.get( fileIter.next() );
	}


	return files;
    }