There's probably a better way of doing this if you use [the Node path module](http://nodejs.org/api/path.html).