Fixes ROOT_PATH detection on Windows

Also converts ROOT_DIR detection to always use forward slashes. And it fixes
the removal of the leading double-backslash on Windows UNC names (fixes #649)