Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Side by Side Diff: build/android/devil/utils/file_utils.py

Issue 1770943003: [Android] Remove chromium version of devil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/devil/utils/cmd_helper_test.py ('k') | build/android/devil/utils/geometry.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 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
7
8 def MergeFiles(dest_file, source_files):
9 """Merge list of files into single destination file.
10
11 Args:
12 dest_file: File to be written to.
13 source_files: List of files to be merged. Will be merged in the order they
14 appear in the list.
15 """
16 if not os.path.exists(os.path.dirname(dest_file)):
17 os.makedirs(os.path.dirname(dest_file))
18 try:
19 with open(dest_file, 'w') as dest_f:
20 for source_file in source_files:
21 with open(source_file, 'r') as source_f:
22 dest_f.write(source_f.read())
23 except Exception as e: # pylint: disable=broad-except
24 # Something went wrong when creating dest_file. Cleaning up.
25 try:
26 os.remove(dest_file)
27 except OSError:
28 pass
29 raise e
30
31
OLDNEW
« no previous file with comments | « build/android/devil/utils/cmd_helper_test.py ('k') | build/android/devil/utils/geometry.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698