You can call (clojure.java.io/delete-file some-file :not-deleted) and
you'll get true if the delete succeeds and :not-deleted if it fails.
On Sat, Feb 9, 2013 at 1:32 PM, AtKaaZ <atk...@gmail.com> wrote:
> Hi, does anyone see anything wrong with this?
>
> => (source clojure.java.io/delete-file)
> (defn delete-file
>   "Delete file f. Raise an exception if it fails unless silently is true."
>   {:added "1.2"}
>   [f & [silently]]
>   (or (.delete (file f))
>       silently
>       (throw (java.io.IOException. (str "Couldn't delete " f)))))
> nil
>
> If you don't already, see below:
>
> => (.delete (q/newClass java.io.File "a.tx1"))
> false
> => (.delete (q/newClass java.io.File "c:\\a.tx1"))
> true
>
> => (clojure.java.io/delete-file (new java.io.File "c:\\a.tx1"))
> IOException Couldn't delete c:\a.tx1  clojure.java.io/delete-file
> (io.clj:425)
> => (clojure.java.io/delete-file (new java.io.File "c:\\a.tx1") true)
> true
> => (clojure.java.io/delete-file (new java.io.File "c:\\a.tx1") 1)
> 1
>
> Yep, I do need it to return the true/false status from .delete
> fix?
>
> => *clojure-version*
> {:major 1, :minor 5, :incremental 0, :qualifier "RC14"}
>
>
>
>
> --
> Please correct me if I'm wrong or incomplete,
> even if you think I'll subconsciously hate it.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to