Skip to content

Commit

Permalink
Ensure directory exists when p4printing file into it
Browse files Browse the repository at this point in the history
  • Loading branch information
ca-johnson committed Aug 20, 2019
1 parent 4e0ad1e commit 9a13095
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/perforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ def p4print_unshelve(self, changelist):
os.chmod(localfile, stat.S_IWRITE)
os.unlink(localfile)
if content:
if not os.path.exists(os.path.dirname(localfile)):
os.makedirs(os.path.dirname(localfile))
with open(localfile, 'w') as outfile:
outfile.write(content)
finally:
Expand Down

0 comments on commit 9a13095

Please sign in to comment.