Skip to content

Update modified time when closing written files#86

Open
Old-Ding wants to merge 1 commit into
FreeRTOS:mainfrom
Old-Ding:codex/update-modified-time-on-close
Open

Update modified time when closing written files#86
Old-Ding wants to merge 1 commit into
FreeRTOS:mainfrom
Old-Ding:codex/update-modified-time-on-close

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 1, 2026

Copy link
Copy Markdown

Closes #81

Summary

  • Add ffconfigUPDATE_FILE_MODIFIED_TIME_ON_CLOSE, defaulting to 0 to preserve existing close-time behavior.
  • Track actual file changes with FF_VALID_FLAG_MODIFIED after successful writes or EOF truncation.
  • Reuse the existing FF_Close() directory-entry update to refresh xModifiedTime when the opt-in config is enabled.

Testing

  • git diff --check upstream/main...HEAD
  • Verified touched files are UTF-8 without BOM and use CRLF line endings.
  • Not run: cmake -S test/unit-test -B test/unit-test/build/ because cmake is unavailable on this Windows host; Ruby and a C compiler are also unavailable locally.

@Old-Ding Old-Ding marked this pull request as ready for review July 1, 2026 07:44
@Old-Ding

Old-Ding commented Jul 4, 2026

Copy link
Copy Markdown
Author

Follow-up verification:

  • The implementation follows the direction discussed in [BUG] FF_Close() does not update xModifiedTime with current system time when file is modified (ffconfigTIME_SUPPORT=1) #81: the new behavior is opt-in through ffconfigUPDATE_FILE_MODIFIED_TIME_ON_CLOSE, defaulting to 0 to preserve existing close-time behavior.
  • The timestamp update reuses the existing directory-entry write in FF_Close(), so it does not add a second FF_GetEntry() / FF_PutEntry() cycle for modified files.
  • Unit tests were added for the unchanged-size modified-file case and the unmodified-file case, and git diff --check upstream/main...HEAD passes.

I still do not have CMake/Ruby/a C toolchain available on this Windows host to run the new unit test locally.

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.

[BUG] FF_Close() does not update xModifiedTime with current system time when file is modified (ffconfigTIME_SUPPORT=1)

2 participants