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

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

Issue 1033053002: [telemetry] Refactoring script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/util/path.py
diff --git a/tools/telemetry/telemetry/util/path.py b/tools/telemetry/telemetry/util/path.py
index 7feb861bdfba2c627cae5c062d998c5da32f7d29..fce896e1666cc87fe18f0465dcf39caed2b18092 100644
--- a/tools/telemetry/telemetry/util/path.py
+++ b/tools/telemetry/telemetry/util/path.py
@@ -41,3 +41,17 @@ def FindInstalledWindowsApplication(application_path):
return path
return None
+
+
+def InDirectory(subdirectory, directory):
+ """Returns True iff subdirectory is or is in directory.
+
+ A little bit of a misnomer, since it works even if they're files."""
eakuefner 2015/03/27 17:55:06 Do we actually need this? Why not just get the pat
dtu 2015/03/27 19:17:15 This is surprisingly tricky, and people get it wro
+ subdirectory = os.path.realpath(subdirectory)
+ directory = os.path.realpath(directory)
+
+ while len(subdirectory) >= len(directory):
+ if subdirectory == directory:
+ return True
+ subdirectory = os.path.split(subdirectory)[0]
+ return False
« tools/telemetry/refactor ('K') | « tools/telemetry/telemetry/util/find_dependencies.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698