Mercurial > rlm
diff src/rlm/sanitize_file.clj @ 0:78a630e650d2
initial import
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 18 Oct 2011 00:57:08 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/rlm/sanitize_file.clj Tue Oct 18 00:57:08 2011 -0700 1.3 @@ -0,0 +1,19 @@ 1.4 +(ns rlm.sanitize-file 1.5 + (:import java.io.File) 1.6 + (:use clojure.contrib.str-utils)) 1.7 + 1.8 + 1.9 +(defn sanitize-file-name 1.10 + "given a file name, convert it into a valid file name. 1.11 + currently only works for linux" 1.12 + [#^String name] 1.13 + ;; as far as I know, all that must be done is removal of the 1.14 + ;; path separator. 1.15 + 1.16 + (re-gsub 1.17 + (re-pattern (str File/separatorChar)) 1.18 + " " ;; replace "/" with " " 1.19 + name)) 1.20 + 1.21 + 1.22 +