Skip to content

Commit

Permalink
SDFG.save() now performs tilde expansion. (#1578)
Browse files Browse the repository at this point in the history
I noticed that it would be cool if I could write
`sdfg.save("~/tmp/faulty.sdfg")` and it would save it into my home
directory, instead in a directory `./~` in some random directory.
  • Loading branch information
philip-paul-mueller authored May 29, 2024
1 parent b6fbd76 commit 7214739
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dace/sdfg/sdfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,8 @@ def save(self, filename: str, use_pickle=False, hash=None, exception=None, compr
:param compress: If True, uses gzip to compress the file upon saving.
:return: The hash of the SDFG, or None if failed/not requested.
"""
filename = os.path.expanduser(filename)

if compress:
fileopen = lambda file, mode: gzip.open(file, mode + 't')
else:
Expand Down

0 comments on commit 7214739

Please sign in to comment.