diff --git a/tools/libinput-replay.py b/tools/libinput-replay.py index c120f2c7..a88c47ea 100755 --- a/tools/libinput-replay.py +++ b/tools/libinput-replay.py @@ -337,10 +337,14 @@ def setup_quirks(recording): sys.exit(1) overrides.parent.mkdir(exist_ok=True) - with overrides.open("w+") as fd: - fd.write("# This file was generated by libinput replay\n") - fd.write("# Unless libinput replay is running right now, remove this file.\n") - fd.write("\n\n".join(quirks)) + try: + with overrides.open("w+") as fd: + fd.write("# This file was generated by libinput replay\n") + fd.write("# Unless libinput replay is running right now, remove this file.\n") + fd.write("\n\n".join(quirks)) + except IOError: + error("Warning: Couldn't write to {}, please re-run as root".format(overrides)) + return None return overrides