Skip to content

Multiple sort options as a parameter #65

Open

Description

@joel16

Hi, I was wondering if there's a possibility to have tinydir_open_sorted to have multiple sorting options. One way I can think of to achieve this would be to pass our own (comparator?) like this one https://github.com/cxong/tinydir/blob/master/tinydir.h#L755

This would allow the user to sort alphabetically in both ascending/descending order as well sorting by size, timestamps etc.

Activity

  1. cxong commented on Sep 25, 2019

    @cxong
    Owner

    I prefer keeping compatibility, which means we could add a new function like tinydir_open_custom which can take in a comparator.

    To maintain forward compatibility, we could define an options struct, which just has the comparator for now, but could have more fields in the future.

    As a workaround for now, you could perform your own qsort on dir._files.

  2. joel16 commented on Sep 26, 2019

    @joel16
    Author

    Thanks for your response, I may as well go with your workaround for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions