# FileChooser.sortFile

`com.jsmacrosce.jsmacros.client.gui.overlays.FileChooser.sortFile`

Comparator used by the chooser to order directories before other entries, then entries by case-sensitive lexicographic basename.  
 ```js
function compareFiles(a, b) {
  const Sorter = Java.type('com.jsmacrosce.jsmacros.client.gui.overlays.FileChooser$sortFile');  
  return new Sorter().compare(a, b);  
}
 ```

Nested type declared in [FileChooser](FileChooser.md).

## Constructors

### new FileChooser.sortFile {#com.jsmacrosce.jsmacros.client.gui.overlays.FileChooser.sortFile_constructor-}

```js
new FileChooser.sortFile()
```

## Methods

### compare {#com.jsmacrosce.jsmacros.client.gui.overlays.FileChooser.sortFile_compare-File-File-}

```js
compare(File a, File b): int
```

Compares entries by directory status and then case-sensitive basename; it does not compare full paths.

**Parameters:**
- `a`: first native Java file entry
- `b`: second native Java file entry

**Returns:** negative when `a` sorts first, positive when `b` sorts first, or zero for equal directory status and basename even when paths differ
