fgof-temp Public
Go to file
T
Code
Use Git or checkout with SVN using the web URL.
No matching headings.
fgof-temp
Temp files, temp directories, and atomic writes for modern Fortran.
fgof-temp is intended to be a small, standalone library for the file-lifecycle
helpers that command-line tools, editors, caches, and test fixtures keep
hand-rolling.
It is part of the FortranGoingOnForty lib-modules
catalog, but it is intended to stand on its own as a normal fpm package.
Current v1 target:
- create temp files and temp directories safely
- expose stable option and resource types
- support atomic write and replace flows
- keep cleanup and ownership rules explicit
Future scope:
- temp worktrees and richer fixture builders
- cache-oriented helpers layered on top
- state persistence helpers built on atomic replace semantics
Status
Sprint 04 is in place, and the package is in release audit.
Tracked today:
- real temp file and temp directory creation
- text-focused
atomic_write()andreplace_file()helpers - explicit
close_temp()/release_temp()semantics ontemp_resource temp_guardownership-transfer cleanup for grouped resource lifecycles- tracked examples plus CI coverage for tests and examples
Why Use It
- temp paths and atomic replace logic show up everywhere in tool code
- most projects still hand-roll cleanup, naming, and safety rules
- a focused library here can become the base for future cache and state packages
Public API Shape
Primary modules:
fgof_tempfgof_temp_types
Public types:
temp_optionstemp_resourcewrite_resulttemp_guard
Public constants:
FGOF_TEMP_OKFGOF_TEMP_ERR_INVALID_OPTIONSFGOF_TEMP_ERR_CREATE_FAILEDFGOF_TEMP_ERR_CLEANUP_FAILEDFGOF_TEMP_ERR_WRITE_FAILEDFGOF_TEMP_ERR_REPLACE_FAILEDFGOF_TEMP_ERR_INTERNAL
Current public procedures:
clear_temp_optionsclear_temp_resourcemake_temp_filemake_temp_dircleanup_tempclose_temprelease_tempclear_write_resultatomic_writereplace_fileclear_temp_guardregister_tempcleanup_guardguard_entry_counttemp_backend_nametemp_error_name
Current semantics:
make_temp_file()creates a real file path and closes the created handle before returningmake_temp_dir()creates a real directory pathcleanup_temp()removes owned resources explicitlyclose_temp()respectscleanup_on_close: it deletes owned resources when enabled and otherwise just releases ownershiprelease_temp()leaves the path in place but hands cleanup responsibility back to the calleratomic_write(path, text)writes through a same-directory temp file and then renames into placereplace_file(source, destination)renames an existing file into place with replacement semanticsregister_temp()transfers ownership from atemp_resourceinto atemp_guardcleanup_guard()walks tracked resources in reverse order, which is the safe default for nested temp trees- temp-file
suffixis supported - temp-directory
suffixis not supported in this first pass and is rejected as invalid options atomic_write()is text-focused inv0.1; it preserves the exact Fortran character payload you pass in
Build And Test
fpm test
That is the baseline verification command locally and in CI.
Tracked examples:
Supported Platforms
- macOS
- Linux
Boundaries
- intended to stay independently versioned and releasable
- focused on temp-path and atomic-write ergonomics, not full cache management
- should stay useful on its own even if future packages build on top of it
License
MIT