Skip to content

Fix/1.2.1#4

Merged
lupodevelop merged 9 commits into
mainfrom
fix/1.2.1
Apr 21, 2026
Merged

Fix/1.2.1#4
lupodevelop merged 9 commits into
mainfrom
fix/1.2.1

Conversation

@lupodevelop

Copy link
Copy Markdown
Owner

This pull request introduces a patch release (v1.2.1) with important bug fixes and improvements to file handling and documentation, as well as updates to the development demo code for consistency and clarity.

Bug fixes and improvements:

  • read_lines now normalizes Windows (\r\n) line endings to Unix (\n), preventing subtle bugs when comparing lines read from files across platforms.
  • The atomic helper now creates temporary files in the same directory as the target with a .__fio_tmp_* prefix, matching write_atomic and ensuring compatibility with atomic renames and consistent cleanup.

Normalize Windows CRLF to LF when reading lines by replacing "\r\n" with "\n" before splitting. Change atomic() to place the temporary file in the same directory as the target and use the ".__fio_tmp_*" prefix (internal.unique_name("fio_atomic_")) instead of appending a ".tmp.*" suffix to the path.
Bump dependencies in manifest.toml
Add tests for fio.read_lines to verify correct handling of CRLF and mixed line endings (read_lines_crlf_test, read_lines_mixed_endings_test). Add tests for atomic temporary file behavior: ensure tmp files are created in the same directory as the target (atomic_tmp_in_same_dir_test) and that tmp filenames include the .__fio_tmp_ prefix (atomic_tmp_prefix_test). Update a comment in atomic_helper_test to clarify error propagation expectations. Tests clean up created files/directories.
Replace generic woof.field/woof.int_field/woof.bool_field calls with typed helpers (woof.str, woof.int, woof.bool) throughout dev/fio_dev.gleam. Updates logging of paths, errors, counts, booleans and ints to use the new logging API; no functional behavior changes aside from log call signatures.
Update README to document implementation details: the `fio.atomic` helper now explicitly notes that temporary files are created in the same directory as the target using the `.__fio_tmp_*` prefix (consistent with `write_atomic`). Also clarify that `read_lines` normalizes both `\r\n` and `\n` line endings.
Document that `fio.read_lines(path)` normalises both CRLF and LF line endings (\r\n and \n). Also expand `fio.atomic(path, callback)` to specify it writes via a temp file in the same directory as the target with a `.__fio_tmp_*` prefix before atomically renaming. Improves clarity on cross-platform line handling and atomic write semantics.
Add 1.2.1 changelog entry:
Collapse several wrapped/multi-line expressions into single lines in dev/fio_dev.gleam and src/fio.gleam. These are formatting-only changes (no logic modified): combine short case arms and long woof.str/woof.bool calls, inline join_all and safe_relative calls, and compact the temporary path construction in atomic for improved readability.
@lupodevelop lupodevelop merged commit 53e8cbe into main Apr 21, 2026
1 check 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.

1 participant