summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clj/clojure/java/io.clj15
-rw-r--r--test/clojure/test_clojure/java/io.clj7
2 files changed, 7 insertions, 15 deletions
diff --git a/src/clj/clojure/java/io.clj b/src/clj/clojure/java/io.clj
index ec2404f8..97ae4e3e 100644
--- a/src/clj/clojure/java/io.clj
+++ b/src/clj/clojure/java/io.clj
@@ -412,20 +412,9 @@
silently
(throw (java.io.IOException. (str "Couldn't delete " f)))))
-(defn delete-file-recursively
- "Delete file f. If it's a directory, recursively delete all its contents.
- Raise an exception if any deletion fails unless silently is true."
- {:added "1.2"}
- [f & [silently]]
- (let [f (file f)]
- (if (.isDirectory f)
- (doseq [child (.listFiles f)]
- (delete-file-recursively child silently)))
- (delete-file f silently)))
-
(defn make-parents
- "Create all parent directories of file. Pass extra args
- as you would to file."
+ "Given the same arg(s) as for file, creates all parent directories of
+ the file they represent."
{:added "1.2"}
[f & more]
(.mkdirs (.getParentFile ^File (apply file f more))))
diff --git a/test/clojure/test_clojure/java/io.clj b/test/clojure/test_clojure/java/io.clj
index 1841ada0..d193942d 100644
--- a/test/clojure/test_clojure/java/io.clj
+++ b/test/clojure/test_clojure/java/io.clj
@@ -178,8 +178,11 @@
(deftest test-make-parents
(let [tmp (System/getProperty "java.io.tmpdir")]
- (delete-file-recursively (file tmp "test-make-parents") :silently)
+ (delete-file (file tmp "test-make-parents" "child" "grandchild") :silently)
+ (delete-file (file tmp "test-make-parents" "child") :silently)
+ (delete-file (file tmp "test-make-parents") :silently)
(make-parents tmp "test-make-parents" "child" "grandchild")
(is (.isDirectory (file tmp "test-make-parents" "child")))
(is (not (.isDirectory (file tmp "test-make-parents" "child" "grandchild"))))
- (delete-file-recursively (file tmp "test-make-parents"))))
+ (delete-file (file tmp "test-make-parents" "child"))
+ (delete-file (file tmp "test-make-parents"))))