Skip to content

Conversation

@VishnuSanal
Copy link
Member

Description

Issue tracker

fixes #892

Automatic tests

  • Added test cases

Manual tests

  • Done

  • tested on A14 (cut, copy) * (file, directory).

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@VishnuSanal VishnuSanal added Issue-Severe (high) Showstopper issues that require immediate attention Area-FileOperations Related to file operations (e.g. moving, copying, renaming). labels May 7, 2024
@VishnuSanal
Copy link
Member Author

build test apk

@github-actions
Copy link

github-actions bot commented May 7, 2024

The requested APKs has been built. Please find them from the artifacts section of this PR.

@VishnuSanal VishnuSanal changed the title fix last modifeid timestamps not getting preserved fix last modified timestamps not getting preserved May 7, 2024
if (getFile().setLastModified(date)) return true;

try {
Files.setLastModifiedTime(getFile().toPath(), FileTime.fromMillis(date));
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if it runs on Android < 8? Perhaps you may need to trap Exceptions like NoSuchMethodException as well.

https://developer.android.com/reference/java/nio/file/Files#setLastModifiedTime(java.nio.file.Path,%20java.nio.file.attribute.FileTime)

(Although I too expect minimal Android version requirement would need to be raised soon as well)

Copy link
Member Author

Choose a reason for hiding this comment

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

trapping NoSuchMethodException gives a compiler error. did version checking to avoid this issue.

@VishnuSanal VishnuSanal requested a review from TranceLove June 4, 2024 03:09
@VishalNehra VishalNehra merged commit 6984fc7 into release/4.0 Jul 8, 2024
@VishalNehra VishalNehra deleted the fix-last-modified branch July 8, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-FileOperations Related to file operations (e.g. moving, copying, renaming). Issue-Severe (high) Showstopper issues that require immediate attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timestamps not kept when moving

4 participants