Skip to content

Implement copy-and-delete fallback for atomicMove#159

Merged
xxfast merged 3 commits into
xxfast:masterfrom
THEAccess:master
Jun 27, 2026
Merged

Implement copy-and-delete fallback for atomicMove#159
xxfast merged 3 commits into
xxfast:masterfrom
THEAccess:master

Conversation

@THEAccess

Copy link
Copy Markdown
Contributor

Fixes #137

This change introduces a fallback mechanism for atomicMove in FileCodec.kt. If atomicMove is unsupported (e.g., on Android 7 and below), it now attempts to copy the temporary file to the destination and then deletes the temporary file. Error handling is included to ensure the temporary file is cleaned up in case of a copy failure.

I don't know if this is the best solution. Comments welcome.

This change introduces a fallback mechanism for `atomicMove` in `FileCodec.kt`. If `atomicMove` is unsupported (e.g., on Android 7 and below), it now attempts to copy the temporary file to the destination and then deletes the temporary file. Error handling is included to ensure the temporary file is cleaned up in case of a copy failure.
@BenjyTec

Copy link
Copy Markdown

Thanks for the fix - the maintainer needs to approve this merge, correct?

@THEAccess

Copy link
Copy Markdown
Contributor Author

Thanks for the fix - the maintainer needs to approve this merge, correct?

Yes, that is correct

@xxfast

xxfast commented Oct 26, 2025

Copy link
Copy Markdown
Owner

Hi! Thanks for the PR. Is there a way to branch off to the unsupported mode for unit testing purpose?

Copilot AI review requested due to automatic review settings June 27, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.68%. Comparing base (f745302) to head (9b17f88).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
+ Coverage   92.24%   92.68%   +0.44%     
==========================================
  Files           8        8              
  Lines         116      123       +7     
  Branches       12       12              
==========================================
+ Hits          107      114       +7     
  Misses          1        1              
  Partials        8        8              
Files with missing lines Coverage Δ
...n/kotlin/io/github/xxfast/kstore/file/FileCodec.kt 100.00% <100.00%> (ø)

@xxfast xxfast left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contributions 🫡 Sorry for the delay

@xxfast xxfast merged commit 58661c9 into xxfast:master Jun 27, 2026
8 checks passed
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.

Android 7. Crash. UnsupportedOperationException: Atomic move not supported

4 participants