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

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

Issue 1860643002: Fix stack trace symbolization on Windows. (Closed) Base URL: https://github.com/kenrussell/catapult.git@master
Patch Set: Created 4 years, 8 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: telemetry/telemetry/internal/util/path.py
diff --git a/telemetry/telemetry/internal/util/path.py b/telemetry/telemetry/internal/util/path.py
index 3f454c09d197b0c05fa7e9a4d15a3a275f31dc6c..5c3616fead085ee1fb02dfaff9e5e1fa74d9fc83 100644
--- a/telemetry/telemetry/internal/util/path.py
+++ b/telemetry/telemetry/internal/util/path.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import glob
import os
from telemetry.core import util
@@ -17,6 +18,11 @@ GetBuildDirectories = util.GetBuildDirectories
IsExecutable = catapult_util.IsExecutable
+def _HasWildcardCharacters(input_string):
+ # Could make this more precise.
+ return '*' in input_string or '+' in input_string
+
+
def FindInstalledWindowsApplication(application_path):
"""Search common Windows installation directories for an application.
@@ -29,14 +35,17 @@ def FindInstalledWindowsApplication(application_path):
os.getenv('PROGRAMFILES'),
os.getenv('LOCALAPPDATA')]
search_paths += os.getenv('PATH', '').split(os.pathsep)
-
for search_path in search_paths:
if not search_path:
continue
path = os.path.join(search_path, application_path)
- if IsExecutable(path):
- return path
-
+ if _HasWildcardCharacters(path):
+ paths = glob.glob(path)
+ else:
+ paths = [path]
+ for p in paths:
+ if IsExecutable(p):
+ return p
return None

Powered by Google App Engine
This is Rietveld 408576698