source: project/wiki/eggref/5/with-current-directory @ 36801

Last change on this file since 36801 was 36801, checked in by evhan, 11 months ago

wiki/eggref: update docs/formatting/urls and eggref/5/{r7rs,fancypants,chicken-belt}

File size: 899 bytes
Line 
1[[tags: egg]]
2
3== with-current-directory
4
5[[toc:]]
6
7== Description
8
9Convenience procedure for temporarily changing directories.
10
11The source for this extension is available [[https://git.foldling.org/chicken-with-current-directory.git|here]].
12
13== Usage
14
15<procedure>(with-current-directory path thunk)</procedure>
16
17Changes directory to the given {{path}}, calls {{thunk}}, and restores the original working directory afterwards.
18
19Note that '''this procedure is not thread-safe'''. The current directory is a process-level value, and this extension makes no attempt to preserve thread-specific working directories across interrupts. If the calling thread is preempted or yields before the thunk's body returns, the given path will persist as the process's current working directory at least until the calling thread is resumed.
20
21== Author
22
23[[/users/evan-hanson|Evan Hanson]]
24
25== License
26
27Public Domain
Note: See TracBrowser for help on using the repository browser.