So, again, I'm trying to use Clojure to rebuild a PHP site. Right now I 
need the Clojure code to read the PHP session files. In the below function, 
I have a println that shows me that the path points to a file that really 
does exist. And yet this if() clause seems to always return false.  

(defn does-session-exist? [session-id]
  (let [path-to-session-file (str "/var/lib/php5/sess_" session-id)]
    (println path-to-session-file)
    (if (io/file path-to-session-file)
      true
      false)))

"io" is an alias:

  (:require [clojure.string :as st]
             [clojure.java.io :as io]
             [clojure.data.json :as json]
             [who-is-logged-in.memory_display :as who]) 


I look here and see that the old monolithic Clojure contrib had an "exists" 
function:

http://clojuredocs.org/clojure_contrib/clojure.contrib.java-utils/file

I see this example:

(. (clojure.contrib.java-utils/file "...") exists)

I'd like to  do that but I don't know how with the modern clojure.java.io. 

I know I can use Java File objects, which has a similar "exists" method, 
but I wonder if there is any modern Clojure equivalent? 











-- 
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

Reply via email to