diff --git a/cf_remote/utils.py b/cf_remote/utils.py index 013f3c0..d0522a1 100644 --- a/cf_remote/utils.py +++ b/cf_remote/utils.py @@ -70,10 +70,13 @@ def read_file(path): def save_file(path, data): - if "/" in path: - mkdir("/".join(path.split("/")[0:-1])) - with open(path, "w") as f: - f.write(data) + try : + if "/" in path: + mkdir("/".join(path.split("/")[0:-1])) + with open(path, "w") as f: + f.write(data) + except PermissionError: + user_error("No permission to write to '{}'.".format(path)) def pretty(data):