def unix_path_to_win(path, root_prefix=u''):
 if ((len(path) > 1) and ((u';' in path) or ((path[1] == u':') and (path.count(u':') == 1)))):
  return path.replace(u'/', u'\\')
 path_re = (root_prefix + u'/([a-zA-Z])(/(?:(?![:\\s]/)[^:*?"<>])*)')
 def _translation(found_path):
  return u'{0}:{1}'.format(found_path.group(1), found_path.group(2).replace(u'/', u'\\'))
 path = re.sub(path_re, _translation, path)
 path = re.sub(u':([a-zA-Z]):\\\\', u';\\1:\\\\', path)
 return path

def unix_path_to_win ( path , root_prefix = u'' ) : if ( ( len ( path ) > 1 ) and ( ( u';' in path ) or ( ( path [ 1 ] == u':' ) and ( path . count ( u':' ) == 1 ) ) ) ) : return path . replace ( u'/' , u'\\' ) path_re = ( root_prefix + u'/([a-zA-Z])(/(?:(?![:\\s]/)[^:*?"<>])*)' ) def _translation ( found_path ) : return u'{0}:{1}' . format ( found_path . group ( 1 ) , found_path . group ( 2 ) . replace ( u'/' , u'\\' ) ) path = re . sub ( path_re , _translation , path ) path = re . sub ( u':([a-zA-Z]):\\\\' , u';\\1:\\\\' , path ) return path
convert a path or :-separated string of paths into a windows representation does not add cygdrive .