• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2013 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Embeds Chrome user data files in C++ code."""
7
8import optparse
9import os
10import sys
11
12import cpp_source
13
14
15def main():
16  parser = optparse.OptionParser()
17  parser.add_option(
18      '', '--directory', type='string', default='.',
19      help='Path to directory where the cc/h  file should be created')
20  options, args = parser.parse_args()
21
22  global_string_map = {}
23  for data_file in args:
24    title = os.path.basename(os.path.splitext(data_file)[0]).title()
25    var_name = 'k' + title.replace('_', '')
26    with open(data_file, 'r') as f:
27      contents = f.read()
28    global_string_map[var_name] = contents
29
30  cpp_source.WriteSource('user_data_dir', 'chrome/test/chromedriver/chrome',
31                         options.directory, global_string_map)
32
33
34if __name__ == '__main__':
35  sys.exit(main())
36