Skip to content

fix(filesystem): make readdir ordering deterministic across iOS and Android#73

Open
antonymarion wants to merge 2 commits into
ionic-team:mainfrom
antonymarion:fix/readdir-chronological-order
Open

fix(filesystem): make readdir ordering deterministic across iOS and Android#73
antonymarion wants to merge 2 commits into
ionic-team:mainfrom
antonymarion:fix/readdir-chronological-order

Conversation

@antonymarion
Copy link
Copy Markdown

@antonymarion antonymarion commented Apr 15, 2026

Closes #74

Summary

  • make readdir results deterministic on Android by sorting entries by mtime, then ctime, then case-insensitive name
  • apply the same ordering strategy on iOS so both platforms return the same chronological ordering semantics
  • keep API shape unchanged while eliminating platform-dependent native directory iteration order

Test plan

  • create files with distinct modification times in the same folder and call Filesystem.readdir on Android
  • run the same scenario on iOS and verify identical ordering
  • verify tie-breakers by creating files with same mtime and checking ctime, then name ordering
  • ensure returned fields (name, type, size, mtime, ctime, uri) are unchanged

@antonymarion
Copy link
Copy Markdown
Author

Context link with issue #74:

  • Product problem: in offline-first mobile apps, Filesystem.readdir() can return different orders between iOS and Android, which can break queue/timeline/sync ordering assumptions.
  • Technical fix in this PR: make readdir ordering deterministic on both platforms using the same sort strategy (mtime -> ctime -> case-insensitive name).
  • Expected result: same chronological ordering semantics on iOS and Android, reducing cross-platform behavioral drift for file-processing logic.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filesystem.readdir returns platform-dependent order between iOS and Android

1 participant