janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
117 stars 35 forks source link

Add make-temp-dir and friends #190

Closed sogaiu closed 1 month ago

sogaiu commented 1 month ago

This is an attempt to address #189 including some tests.

There are four functions:

make-temp-dir tries to create a temporary directory that lives under some temporary directory that a system already has (the function temp-root tries to determine this) and tries to do so according to a template.

windows-temp-root and posix-temp-root are supporting functions for the temp-root function.

See the docstring of each for details.

I'm not certain what temp-root should return for MinGW and Cygwin setups. For the moment I've gone with /tmp for both. If someone happens to know or can check, I'm happy to modify. Otherwise, may be if these are wrong, they can get corrected later (^^;

sogaiu commented 1 month ago

Not making much progress getting info about the MinGW and Cygwin cases and may be it wouldn't be bad to get some more experience using the existing code so I'm going to close this for now.


On a related note, @yumaikas has a library called janet-tempfiles that has some intersecting functionality.