Commit 6ce3d3b4 authored by engedy@chromium.org's avatar engedy@chromium.org

Make pretty_print.py look for a histograms.xml in the current working directory first.

This will allow the script to be used with files in directories other than tools/metrics/histograms. Furthermore, print the relative path of the histograms.xml file actually used to avoid
confusion.

BUG=None

Review URL: https://codereview.chromium.org/163473008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251449 0039d316-1c4b-4281-b951-d872f2087c98
parent ce22687f
......@@ -322,13 +322,17 @@ def main():
histograms_filename = 'histograms.xml'
histograms_backup_filename = 'histograms.before.pretty-print.xml'
script_dir = path_utils.ScriptDir()
histograms_pathname = os.path.join(script_dir, histograms_filename)
histograms_backup_pathname = os.path.join(script_dir,
# If there is a histograms.xml in the current working directory, use that.
# Otherwise, use the one residing in the same directory as this script.
histograms_dir = os.getcwd()
if not os.path.isfile(os.path.join(histograms_dir, histograms_filename)):
histograms_dir = path_utils.ScriptDir()
histograms_pathname = os.path.join(histograms_dir, histograms_filename)
histograms_backup_pathname = os.path.join(histograms_dir,
histograms_backup_filename)
logging.info('Loading %s...' % histograms_filename)
logging.info('Loading %s...' % os.path.relpath(histograms_pathname))
with open(histograms_pathname, 'rb') as f:
xml = f.read()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment