OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 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 |
| 5 import os |
| 6 import sys |
| 7 |
| 8 def main(args): |
| 9 """Touches a file. |
| 10 |
| 11 Args: |
| 12 args: An argument list, the first item of which is a file to touch. |
| 13 """ |
| 14 try: |
| 15 os.makedirs(os.path.dirname(args[0])) |
| 16 except OSError: |
| 17 pass |
| 18 with open(args[0], 'a'): |
| 19 os.utime(args[0], None) |
| 20 return 0 |
| 21 |
| 22 |
| 23 if __name__ == '__main__': |
| 24 sys.exit(main(sys.argv[1:])) |
OLD | NEW |