| 
									
										
										
										
											2012-03-31 17:45:59 -04:00
										 |  |  | ! (c)2012 Joe Groff bsd license | 
					
						
							| 
									
										
										
										
											2012-06-18 15:22:59 -04:00
										 |  |  | USING: combinators io.directories io.pathnames kernel system | 
					
						
							|  |  |  | vocabs ;
 | 
					
						
							| 
									
										
										
										
											2008-12-15 03:02:22 -05:00
										 |  |  | IN: io.files.temp | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-31 17:45:59 -04:00
										 |  |  | HOOK: temp-directory os ( -- path )
 | 
					
						
							|  |  |  | HOOK: cache-directory os ( -- path )
 | 
					
						
							| 
									
										
										
										
											2008-12-15 03:02:22 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : temp-file ( name -- path )
 | 
					
						
							| 
									
										
										
										
											2012-03-31 17:45:59 -04:00
										 |  |  |     temp-directory prepend-path ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-18 15:22:59 -04:00
										 |  |  | : with-temp-directory ( quot -- )
 | 
					
						
							|  |  |  |     [ temp-directory ] dip with-directory ; inline
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-31 17:45:59 -04:00
										 |  |  | : cache-file ( name -- path )
 | 
					
						
							|  |  |  |     cache-directory prepend-path ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-18 15:22:59 -04:00
										 |  |  | : with-cache-directory ( quot -- )
 | 
					
						
							|  |  |  |     [ cache-directory ] dip with-directory ; inline
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-31 17:45:59 -04:00
										 |  |  | { | 
					
						
							|  |  |  |     { [ os windows? ] [ "io.files.temp.windows" ] } | 
					
						
							|  |  |  |     { [ os macosx? ] [ "io.files.temp.macosx" ] } | 
					
						
							|  |  |  |     { [ os unix? ] [ "io.files.temp.unix" ] } | 
					
						
							|  |  |  |     [ "unknown io.files.temp platform" throw ] | 
					
						
							|  |  |  | } cond require |