Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

fixes #4125 #4156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions systrace/profile_chrome/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ def _GetResults(trace_results, controller, output, compress, write_json,
util.ArchiveData(trace_results, result)
elif output:
result = output
util.CreateDirectory(result)
with open(result, 'wb') as f:
f.write(trace_results[0].raw_data)
else:
result = trace_results[0].source_name
util.CreateDirectory(result)
with open(result, 'wb') as f:
f.write(trace_results[0].raw_data)

Expand Down
7 changes: 7 additions & 0 deletions systrace/profile_chrome/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ def WriteDataToCompressedFile(data, output):

def GetTraceTimestamp():
return time.strftime('%Y-%m-%d-%H%M%S', time.localtime())

def CreateDirectory(file_name):
# get absolute path of file
dir_name = os.path.dirname(os.path.abspath(file_name))
# create path if necessary
if not os.path.exists(dir_name):
os.makedirs(dir_name)