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

Unified Diff: tools/telemetry/telemetry/core/util.py

Issue 625123002: Make credential_path a page attribute instead of page_set attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/util.py
diff --git a/tools/telemetry/telemetry/core/util.py b/tools/telemetry/telemetry/core/util.py
index 460eb61ec7fb42bd131ac891b96af6769eaaeef3..9e17d8597dbea4bf1efbca23f0303aed723e3a58 100644
--- a/tools/telemetry/telemetry/core/util.py
+++ b/tools/telemetry/telemetry/core/util.py
@@ -126,6 +126,7 @@ def GetBuildDirectories():
for build_type in build_types:
yield build_dir, build_type
+
def GetSequentialFileName(base_name):
"""Returns the next sequential file name based on |base_name| and the
existing files. base_name should not contain extension.
@@ -142,3 +143,16 @@ def GetSequentialFileName(base_name):
break
index = index + 1
return output_name
+
+
+def GetAbsPathIfExist(path, base_dir):
dtu 2014/10/06 21:30:22 Is this the same as os.path.realpath(os.path.relpa
nednguyen 2014/10/07 20:11:09 Not really, this returns path if path is already a
dtu 2014/10/08 21:34:18 This is true of realpath(relpath()) as well, but i
+ """ Returns the absolute path for |path| if it exists. If |path| is relative,
+ then it is relative to the directory of |base_dir|. """
+ abs_path = None
+ if os.path.isabs(path):
+ abs_path = path
+ else:
+ abs_path = os.path.join(base_dir, path)
+ if not os.path.exists(abs_path):
+ return None
+ return os.path.realpath(abs_path)

Powered by Google App Engine
This is Rietveld 408576698