Skip to content
Browse files

fixed file/ensure-file-ext.

  • Loading branch information...
1 parent 18a8496 commit b6a08eecd57ca5df35b1e3ee4d315e7e2b5a9ac7 @fukamachi committed Jan 7, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/L5/file.clj
View
7 src/L5/file.clj
@@ -1,5 +1,6 @@
(ns L5.file
- (:require [clojure.contrib.io :as io])
+ (:require [clojure.contrib.io :as io]
+ [clojure.contrib.string :as string])
(:import [java.io File]
[javax.swing JFrame JPanel JLabel JButton JFileChooser SwingConstants]
[javax.swing.filechooser FileNameExtensionFilter]
@@ -44,8 +45,8 @@
(.exec (Runtime/getRuntime)
(format "%s %s" editor (.getAbsolutePath file))))))))
-(defn- ensure-file-ext [s ext]
- (let [re (re-pattern (apply format "\\.(%s|%s)$" ext))]
+(defn ensure-file-ext [s ext]
+ (let [re (re-pattern (apply format "\\.(%s)$" (string/join "|" ext)))]
(if (re-find re s)
s
(str s "." (first ext)))))

0 comments on commit b6a08ee

Please sign in to comment.
Something went wrong with that request. Please try again.