Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | |
|
Ilya Sherman
2015/05/27 00:12:24
nit: 2015
ncarter (slow)
2015/05/29 23:01:10
Done.
| |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Utility functions for resolving file paths in histograms scripts.""" | |
| 6 | |
| 7 import os.path | |
| 8 | |
| 9 | |
| 10 def GetHistogramsFile(): | |
| 11 """Returns the path to histograms.xml. | |
| 12 | |
| 13 Prefer using this function instead of just open("histograms.xml"), so that | |
| 14 scripts work properly even if run from outside the histograms directory. | |
| 15 """ | |
| 16 return os.path.join(os.path.dirname(__file__), 'histograms.xml') | |
| 17 | |
| 18 | |
| 19 def GetInputFile(src_relative_file_path): | |
|
Ilya Sherman
2015/05/27 00:12:24
Is it worth providing this at a higher level, so t
ncarter (slow)
2015/05/29 23:01:10
I moved it to common (as path_util.py). I also add
| |
| 20 """Converts a src/-relative file path into a path that can be opened.""" | |
| 21 depth = [os.path.dirname(__file__), '..', '..', '..'] | |
| 22 return os.path.join(*(depth + src_relative_file_path.split('/'))) | |
|
Ilya Sherman
2015/05/27 00:12:24
Out of curiousity, what does the "*" operator do?
ncarter (slow)
2015/05/29 23:01:10
https://docs.python.org/2/tutorial/controlflow.htm
| |
| OLD | NEW |