1# Copyright 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import posixpath
6
7def CreateURLsFromPaths(file_system, directory, urlprefix):
8  '''Yields a tuple (url, prefix) for every file in |directory|, where the URL
9  is given relative to |urlprefix|.
10  '''
11  for root, _, files in file_system.Walk(directory):
12    for f in files:
13      url = posixpath.join(urlprefix, root, f)
14      yield url, posixpath.join(directory, root, f)
15