Mercurial > rlm
annotate 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 |
rev | line source |
---|---|
rlm@0 | 1 (ns rlm.sanitize-file |
rlm@0 | 2 (:import java.io.File) |
rlm@0 | 3 (:use clojure.contrib.str-utils)) |
rlm@0 | 4 |
rlm@0 | 5 |
rlm@0 | 6 (defn sanitize-file-name |
rlm@0 | 7 "given a file name, convert it into a valid file name. |
rlm@0 | 8 currently only works for linux" |
rlm@0 | 9 [#^String name] |
rlm@0 | 10 ;; as far as I know, all that must be done is removal of the |
rlm@0 | 11 ;; path separator. |
rlm@0 | 12 |
rlm@0 | 13 (re-gsub |
rlm@0 | 14 (re-pattern (str File/separatorChar)) |
rlm@0 | 15 " " ;; replace "/" with " " |
rlm@0 | 16 name)) |
rlm@0 | 17 |
rlm@0 | 18 |
rlm@0 | 19 |