senchalabs/connect — pull request #914 by dougwilson (2013-10-15 18:03:23+00:00)
Title: Fix directory separators when running on Windows server

This fixes the `directory` middleware to correctly respond with forward slashes as directory separators even when the server is running on Windows.

Fixes #645
Fixes #630
Fixes #846

The way this fixes works is that `dir` comes from the URL, which always has forward slashes. The only place backward slashes are introduced is the `join` call in `html()`. This simply takes that result and swaps all the platform slashes to forward slashes, so nothing changes when the platform has forward slashes, but platforms like Windows get the backward slashes replaced with forward slashes.

The `test/directory.js` tests already failed without this changes on Windows, and now they pass!