Merge pull request #1609 from rogerallen/issue1607

Fix for issue 1607
This commit is contained in:
Jean Niklas L'orange 2014-07-22 09:16:15 +02:00
commit d6b90a0315

View file

@ -79,6 +79,15 @@
(m (first (drop-while #(nil? (re-find (re-pattern %) k))
(keys m)))))
(defn- get-with-pattern-fallback
"Gets a value from map m, but if it doesn't exist, fallback
to use get-by-pattern."
[m k]
(let [exact-match (m k)]
(if (nil? exact-match)
(get-by-pattern m k)
exact-match)))
(def ^:private native-names
{"Mac OS X" :macosx "Windows" :windows "Linux" :linux
"FreeBSD" :freebsd "OpenBSD" :openbsd
@ -88,12 +97,12 @@
(defn get-os
"Returns a keyword naming the host OS."
[]
(get-by-pattern native-names (System/getProperty "os.name")))
(get-with-pattern-fallback native-names (System/getProperty "os.name")))
(defn get-arch
"Returns a keyword naming the host architecture"
[]
(get-by-pattern native-names (System/getProperty "os.arch")))
(get-with-pattern-fallback native-names (System/getProperty "os.arch")))
(defn platform-nullsink
"Returns a file destination that will discard output."