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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/fileutil.py

Issue 1410053006: Move third_party/mojo/src/mojo/public to mojo/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 1 month 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import errno 5 import errno
6 import os.path 6 import os.path
7 7
8 def EnsureDirectoryExists(path, always_try_to_create=False): 8 def EnsureDirectoryExists(path, always_try_to_create=False):
9 """A wrapper for os.makedirs that does not error if the directory already 9 """A wrapper for os.makedirs that does not error if the directory already
10 exists. A different process could be racing to create this directory.""" 10 exists. A different process could be racing to create this directory."""
11 11
12 if not os.path.exists(path) or always_try_to_create: 12 if not os.path.exists(path) or always_try_to_create:
13 try: 13 try:
14 os.makedirs(path) 14 os.makedirs(path)
15 except OSError as e: 15 except OSError as e:
16 # There may have been a race to create this directory. 16 # There may have been a race to create this directory.
17 if e.errno != errno.EEXIST: 17 if e.errno != errno.EEXIST:
18 raise 18 raise
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/error.py ('k') | mojo/public/tools/bindings/pylib/mojom/generate/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698