Fix/1.2.1#4
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_linesnow normalizes Windows (\r\n) line endings to Unix (\n), preventing subtle bugs when comparing lines read from files across platforms.atomichelper now creates temporary files in the same directory as the target with a.__fio_tmp_*prefix, matchingwrite_atomicand ensuring compatibility with atomic renames and consistent cleanup.