magnars/stasis — pull request #8 by nauhygon (2014-04-24 11:49:16+00:00)
Title: Fix: handle backslashes in file names/paths on Windows and make 

When I tried to use Stasis on my Windows box, I had the following error.

```
java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^
Pattern.java:1924 java.util.regex.Pattern.error
Pattern.java:1671 java.util.regex.Pattern.compile
Pattern.java:1337 java.util.regex.Pattern.
Pattern.java:1022 java.util.regex.Pattern.compile
core.clj:4377 clojure.core/re-pattern
core.clj:74 stasis.core/just-the-filename
......
```

After spending some time, I realized it was Windows' backslashes (\\) in the file names or paths that caused it. In `stasis.core/just-the-filename`, it has `(re-pattern (java.io.File/separator))`, equivalent to `(re-pattern "\\")` on Windows, which causes the above Exception. It was also preventing the tests from passing on Windows.

So I made this fix by adding a new local fun `normalize-path`, which uses `java.util.regex.Pattern/quote` to safe quote the separator (backslashes on Windows). It normalizes the paths so backslashes (`\\`) are always converted to forward slashes (`/`). I also made a small fix in the Exception message in `empty-directory!` so all tests can pass.

I am pleased this fixed my problem on Windows, but feel free to discard it if you don't think it's the best way to address the issue. Thanks for making Stasis public.