+def slash_join(*args):
+ r"""Join path components with forward slashes regardless of OS.
+
+ Notes
+ -----
+ From the `PKZIP Application Note`_, section J (Explanation of fields):
+
+ file name: (Variable)
+
+ ... All slashes should be forward slashes ``/`` as opposed to
+ backwards slashes ``\`` for compatibility with Amiga and UNIX
+ file systems etc. ...
+
+ .. _PKZIP Application Note:
+ http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+
+ Examples
+ --------
+
+ >>> sep = os.path.sep
+ >>> os.path.sep = '/'
+ >>> print slash_join('abc', 'def/ghi', 'jkl\\mno')
+ abc/def/ghi/jkl\mno
+ >>> os.path.sep = '\\'
+ >>> print slash_join('abc', 'def/ghi', 'jkl\\mno')
+ abc/def/ghi/jkl\mno
+ >>> os.path.sep = sep
+
+ Note that when :const:`os.path.sep` is ``/`` (e.g. UNIX),
+ ``def/ghi`` is a compound segment, but when :const:`os.path.sep`
+ is ``\`` (e.g. Windows), ``def/ghi`` is a single segment.
+ """
+ sep = os.path.sep
+ try:
+ os.path.sep = '/'
+ return os.path.join(*args)
+ finally:
+ os.path.sep = sep
+
+