Implemented proper pathname normalization function

Previously 'path.normalize' was being used, but this function is intended for
normalizing directory strings and is plataform-specific, so it was causing
issues on windows.