Expand vars and user tilde for upgrade backup

This commit is contained in:
Philip Douglass 2016-01-24 20:21:55 -05:00
parent 452d99f835
commit 9f7d71aa8f

View file

@ -10,6 +10,7 @@ import os
def backup(filename, binary=False):
util.prompt(" Created a backup at {}.backup".format(filename))
filename = os.path.expanduser(os.path.expandvars(filename))
with open(filename, 'rb' if binary else 'r') as original:
contents = original.read()
with open(filename + ".backup", 'wb' if binary else 'w') as backup: