Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
slr71 committed Aug 14, 2013
2 parents fdc37f8 + e2eecd6 commit 130d450
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -7,7 +7,7 @@
[org.clojure/java.classpath "0.2.0"]
[org.apache.tika/tika-core "1.3"]
[org.iplantc/clj-cas "1.0.1-SNAPSHOT"]
[org.iplantc/clj-jargon "0.2.8-SNAPSHOT"
[org.iplantc/clj-jargon "0.2.9-SNAPSHOT"
:exclusions [[xerces/xmlParserAPIs]
[org.irods.jargon.transfer/jargon-transfer-dao-spring]]]
[org.iplantc/clojure-commons "1.4.5-SNAPSHOT"]
Expand Down
11 changes: 5 additions & 6 deletions src/donkey/clients/nibblonian.clj
Expand Up @@ -2,7 +2,7 @@
(:use [donkey.util.config]
[donkey.util.service :only [build-url-with-query]]
[donkey.util.transformers :only [add-current-user-to-map]]
[donkey.auth.user-attributes :only [current-user]]
[donkey.auth.user-attributes :only [current-user]]
[slingshot.slingshot :only [throw+]])
(:require [cheshire.core :as cheshire]
[clj-http.client :as client]
Expand Down Expand Up @@ -36,16 +36,15 @@
Otherwise, a new directory is created and the path is returned."
[path]
(log/debug "getting or creating dir: path =" path)
(let [stats (stat path)]
(cond (nil? stats) (create path)
(= (:type stats) :dir) path
:else nil)))
(cond (fs/path-is-dir? path) path
(fs/path-exists? path) nil
:else (create path)))

(defn gen-output-dir
"Either obtains or creates a default output directory using a specified base name."
[base]
(first
(filter #(not (nil? (get-or-create-dir %)))
(remove #(nil? (get-or-create-dir %))
(cons base (map #(str base "-" %) (iterate inc 1))))))

(defn build-path
Expand Down
22 changes: 19 additions & 3 deletions src/donkey/services/filesystem/actions.clj
Expand Up @@ -509,6 +509,12 @@
[string-to-check]
(re-seq #"\%[A-Fa-f0-9]{2}" string-to-check))

(defn url-decode
[string-to-decode]
(if (url-encoded? string-to-decode)
(url/url-decode string-to-decode)
string-to-decode))

(defn path-exists?
([path]
(path-exists? "" path))
Expand All @@ -517,9 +523,19 @@
(log-rulers
cm [user]
(format-call "path-exists?" user path)
(if (url-encoded? path)
(exists? cm (url/url-decode path))
(exists? cm path))))))
(exists? cm (url-decode path))))))

(defn path-is-dir?
[path]
(let [path (url-decode path)]
(with-jargon (jargon-cfg) [cm]
(and (exists? cm path) (is-dir? cm path)))))

(defn path-is-file?
[path]
(let [path (url-decode path)]
(with-jargon (jargon-cfg) [cm]
(and (exists? cm path) (is-file? cm path)))))

(defn count-shares
[cm user path]
Expand Down

0 comments on commit 130d450

Please sign in to comment.