Bug Report
Plugin
@capacitor/filesystem
Current behavior
Filesystem.readdir() does not guarantee a deterministic order across platforms. In practice, iOS and Android can return entries in different orders for the same logical dataset.
For offline-first apps, this can lead to subtle cross-platform bugs when application code assumes chronological ordering (for sync queues, local media timelines, pending uploads, etc.).
Real-world scenario
A mobile app available on both iOS and Android stores files locally while offline (e.g. photos, notes, or sync payloads). Files are written in chronological order and then listed with readdir() to process oldest-first.
Even when the storage/write behavior is chronologically identical on both platforms, readdir() may return a different order, causing:
- different processing order between platforms,
- inconsistent UI ordering,
- duplicate/conflicting sync behavior in edge cases.
Expected behavior
Filesystem.readdir() should return entries in a deterministic, cross-platform order (for example by mtime, then ctime, then name as stable tie-breaker), or explicitly document and expose sorting controls.
Reproduction idea
- Create multiple files in quick succession in the same directory on iOS and Android.
- Call
Filesystem.readdir() for that directory.
- Compare returned arrays between platforms.
- Observe order differences despite equivalent file creation behavior.
Why this matters
Offline-first applications commonly rely on deterministic local ordering to avoid cross-platform divergence. Platform-dependent directory iteration order can cause hard-to-debug functional regressions.
Bug Report
Plugin
@capacitor/filesystemCurrent behavior
Filesystem.readdir()does not guarantee a deterministic order across platforms. In practice, iOS and Android can return entries in different orders for the same logical dataset.For offline-first apps, this can lead to subtle cross-platform bugs when application code assumes chronological ordering (for sync queues, local media timelines, pending uploads, etc.).
Real-world scenario
A mobile app available on both iOS and Android stores files locally while offline (e.g. photos, notes, or sync payloads). Files are written in chronological order and then listed with
readdir()to process oldest-first.Even when the storage/write behavior is chronologically identical on both platforms,
readdir()may return a different order, causing:Expected behavior
Filesystem.readdir()should return entries in a deterministic, cross-platform order (for example bymtime, thenctime, thennameas stable tie-breaker), or explicitly document and expose sorting controls.Reproduction idea
Filesystem.readdir()for that directory.Why this matters
Offline-first applications commonly rely on deterministic local ordering to avoid cross-platform divergence. Platform-dependent directory iteration order can cause hard-to-debug functional regressions.