• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright (c) 2012 Google Inc. 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# Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument,
7# and writes the absolute path to the file in the 2nd argument to the file in
8# the 3rd argument.
9
10import os
11import shlex
12import sys
13
14if len(sys.argv) == 3 and ' ' in sys.argv[2]:
15  sys.argv[2], fourth = shlex.split(sys.argv[2].replace('\\', '\\\\'))
16  sys.argv.append(fourth)
17
18#print >>sys.stderr, sys.argv
19
20with open(sys.argv[2], 'w') as f:
21  f.write(sys.argv[1])
22
23with open(sys.argv[3], 'w') as f:
24  f.write(os.path.abspath(sys.argv[2]))
25