Skip to content

Commit 321c820

Browse files
committed
[build-script] Create time log dir
If the directory where the build time log is supposed to go doesn't exist, create it. The append file mode will create files, but won't create directories. When we start building ninja, we haven't necessary created the build directory yet, so this results in an error about the missing directory when writing the build time log.
1 parent bbd412b commit 321c820

File tree

1 file changed

+4
-1
lines changed
  • utils/swift_build_support/swift_build_support

1 file changed

+4
-1
lines changed

utils/swift_build_support/swift_build_support/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ def clear_log_time():
4848

4949

5050
def log_time(event, command, duration=0):
51-
f = open(log_time_path(), "a")
51+
log_time_dir = os.path.dirname(log_time_path())
52+
if not os.path.isdir(log_time_dir):
53+
os.mkdir(log_time_dir)
5254

55+
f = open(log_time_path(), "a")
5356
log_event = {
5457
"event": event,
5558
"command": command,

0 commit comments

Comments
 (0)