Comments (2)
UIOP has call-with-temporary-file
, but it doesn't appear to have an option for creating a temporary directory. This seems like an oversight in UIOP, but it's relatively easy to wrap it:
(defun pathname-to-dirname (pathname)
(make-pathname :directory (append (pathname-directory pathname)
(list (pathname-name pathname)))
:name nil
:type nil
:defaults pathname))
(defun call-with-temporary-directory (thunk &rest kwargs &key keep directory prefix suffix)
(declare (ignore directory prefix suffix))
(flet ((called-with-pathname (pathname)
(let ((dirname (pathname-to-dirname pathname)))
(unwind-protect (progn
(ensure-directories-exist dirname)
(funcall thunk dirname))
(unless keep
(uiop:delete-directory-tree dirname
:validate t
:if-does-not-exist :ignore))))))
(apply #'uiop:call-with-temporary-file #'called-with-pathname
:want-stream-p nil
(alexandria:remove-from-plist kwargs :keep))))
Now that I think of it, I'll ask whether the ASDF maintainers would merge that.
from cl-fad.
@gefjon Thanks! I'm curious to know how it turns out.
Thanks for taking the time to work on this!
from cl-fad.
Related Issues (20)
- :description
- please keep cl-test-grid informed about testsuite changes
- WITH-OPEN-TEMPORARY-FILE not working on Windows HOT 2
- Asymmetry between directory-exists-p and directory-pathname-p HOT 1
- list-directory replaces [ characters in filenames with \\[, resulting in an extra slash... HOT 2
- Again: list-directory replaces [ characters in filenames with \\[, resulting in an extra backslash... HOT 8
- error in `list-directory` when encountering a broken symlink HOT 1
- merge temporary-files HOT 5
- Suggestion to prevent infinite loops when traversing HOT 1
- get-default-temporary-directory returns a truename containing :unspecified on LispWorks
- Copy directory recursively HOT 6
- WITH-TEMPORARY-DIRECTORY ?
- add truenameize from asdf HOT 1
- The test compares truename with non-truenames HOT 2
- Bug in PATHNAME-AS-DIRECTORY HOT 5
- Build error for lispworks HOT 2
- CMUCL regression in cl-fad 0.7.0 HOT 1
- Minor issue with the homepage download link
- CentOS 6 compatibility HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-fad.