From 154bc260c637c0c3670ad061648fc99243fdb076 Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Mon, 8 Dec 2008 21:32:36 -0600
Subject: [PATCH] remove io.files.unique.backend rename (make-unique-file) to
 touch-unique-file

---
 basis/io/files/unique/backend/backend.factor |  5 ----
 basis/io/files/unique/unique.factor          | 25 +++++++++++++-------
 basis/io/unix/files/unique/unique.factor     |  4 ++--
 basis/io/windows/files/unique/unique.factor  |  8 +++----
 4 files changed, 22 insertions(+), 20 deletions(-)
 delete mode 100644 basis/io/files/unique/backend/backend.factor

diff --git a/basis/io/files/unique/backend/backend.factor b/basis/io/files/unique/backend/backend.factor
deleted file mode 100644
index 7b9809fa28..0000000000
--- a/basis/io/files/unique/backend/backend.factor
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: io.backend ;
-IN: io.files.unique.backend
-
-HOOK: (make-unique-file) io-backend ( path -- )
-HOOK: temporary-path io-backend ( -- path )
diff --git a/basis/io/files/unique/unique.factor b/basis/io/files/unique/unique.factor
index ec89517bbc..66540fb48e 100644
--- a/basis/io/files/unique/unique.factor
+++ b/basis/io/files/unique/unique.factor
@@ -1,11 +1,13 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math math.bitwise math.parser
-random sequences continuations namespaces
-io.files io arrays io.files.unique.backend system
-combinators vocabs.loader fry ;
+USING: kernel math math.bitwise math.parser random sequences
+continuations namespaces io.files io arrays system
+combinators vocabs.loader fry io.backend ;
 IN: io.files.unique
 
+HOOK: touch-unique-file io-backend ( path -- )
+HOOK: temporary-path io-backend ( -- path )
+
 SYMBOL: unique-length
 SYMBOL: unique-retries
 
@@ -26,12 +28,17 @@ SYMBOL: unique-retries
 
 PRIVATE>
 
+: (make-unique-file) ( path prefix suffix -- path )
+    '[
+        _ _ _ unique-length get random-name glue append-path
+        dup touch-unique-file
+    ] unique-retries get retry ;
+
 : make-unique-file ( prefix suffix -- path )
-    temporary-path -rot
-    [
-        unique-length get random-name glue append-path
-        dup (make-unique-file)
-    ] 3curry unique-retries get retry ;
+    [ temporary-path ] 2dip (make-unique-file) ;
+
+: make-unique-file* ( prefix suffix -- path )
+    [ current-directory get ] 2dip (make-unique-file) ;
 
 : with-unique-file ( prefix suffix quot: ( path -- ) -- )
     [ make-unique-file ] dip [ delete-file ] bi ; inline
diff --git a/basis/io/unix/files/unique/unique.factor b/basis/io/unix/files/unique/unique.factor
index e47ac6a2e3..24dcdcb65a 100644
--- a/basis/io/unix/files/unique/unique.factor
+++ b/basis/io/unix/files/unique/unique.factor
@@ -1,13 +1,13 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel io.ports io.unix.backend math.bitwise
-unix io.files.unique.backend system ;
+unix system io.files.unique ;
 IN: io.unix.files.unique
 
 : open-unique-flags ( -- flags )
     { O_RDWR O_CREAT O_EXCL } flags ;
 
-M: unix (make-unique-file) ( path -- )
+M: unix touch-unique-file ( path -- )
     open-unique-flags file-mode open-file close-file ;
 
 M: unix temporary-path ( -- path ) "/tmp" ;
diff --git a/basis/io/windows/files/unique/unique.factor b/basis/io/windows/files/unique/unique.factor
index b1bf2bdc1c..ab99bf2cac 100644
--- a/basis/io/windows/files/unique/unique.factor
+++ b/basis/io/windows/files/unique/unique.factor
@@ -1,9 +1,9 @@
-USING: kernel system io.files.unique.backend
-windows.kernel32 io.windows io.windows.files io.ports windows
-destructors environment ;
+USING: kernel system windows.kernel32 io.windows
+io.windows.files io.ports windows destructors environment
+io.files.unique ;
 IN: io.windows.files.unique
 
-M: windows (make-unique-file) ( path -- )
+M: windows touch-unique-file ( path -- )
     GENERIC_WRITE CREATE_NEW 0 open-file dispose ;
 
 M: windows temporary-path ( -- path )