janet-lang / spork

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

Add make-temp-dir and friends #190

Closed sogaiu closed 4 months ago

sogaiu commented 4 months 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 4 months 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.