Skip to content

fix: return size for writable files - #1023

Closed
sean0407 wants to merge 1 commit into
bjornbytes:devfrom
sean0407:codex/fix-writable-file-get-size
Closed

sean0407 wants to merge 1 commit into
bjornbytes:devfrom
sean0407:codex/fix-writable-file-get-size

Conversation

@sean0407

Copy link
Copy Markdown

Summary

lovrFileGetSize(file)
- read the size from file->archive unconditionally
+ read the archive size when present; otherwise stat the open writable file

Evidence

  • Before: Issue Crash when calling :getSize on a writable File #1016 reproduces a crash with lovr.filesystem.newFile('asdf', 'w'):getSize(). Writable files have no archive, so the unconditional archive access dereferences NULL.
  • After: Writable files obtain their size through fs_fstat. The filesystem regression case checks both an empty writable file and its size after writing two bytes.
  • git diff --check passed.

Merge Danger

Door: Two-way

Blast Radius: Low

Only file-size queries for files without an archive use the filesystem stat path; archived-file behavior remains unchanged.

@bjornbytes bjornbytes closed this Oct 10, 2026
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.

2 participants