Index: util/__init__.py
===================================================================
--- util/__init__.py	(revision 59269)
+++ util/__init__.py	(working copy)
@@ -11,14 +11,26 @@
 
 import os
 import sys
-import fnmatch
+import fnmatch
+import re
 from os import path
 
 
-def relative_uri(base, to):
-    """Return a relative URL from ``base`` to ``to``."""
-    b2 = base.split('/')
-    t2 = to.split('/')
+def split_path (fullpath, maxsplit=0):
+  """Split a path allowing for any mixture of "\" and "/" delimiters.
+  The maxsplit parameter as the same sense as the equivalent parameter
+  for re.split"""
+    #
+    # FIXME: This won't cleanly handle things like embedded slashes
+    # within filenames etc. but I'm not sure what to do otherwise.
+    #
+    return re.split(r"[%s/]" % os.sep.replace ("\\", "\\\\"), fullpath, maxsplit)
+
+
+def relative_uri(base, to):
+    """Return a relative URL from ``base`` to ``to``."""
+    b2 = split_path(base)
+    t2 = split_path(to)
     # remove common segments
     for x, y in zip(b2, t2):
         if x != y:
@@ -64,10 +76,10 @@
 
 
 def get_category(filename):
-    """Get the "category" part of a RST filename."""
-    parts = filename.split('/', 1)
+    """Get the "category" part of a RST filename."""
+    parts = split_path(filename, 1)
     if len(parts) < 2:
-        return
+        return
     return parts[0]
 
 
