]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Removed isinstance check and redundant path calculation.
authorPatrick Klein <patrick.sean.klein@rwth-aachen.de>
Sat, 5 Oct 2019 20:52:40 +0000 (22:52 +0200)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Thu, 24 Oct 2019 14:15:50 +0000 (16:15 +0200)
autorandr.py

index a2ac5446ab4f33cff337b73fa52db8fd3cf65b7b..44e9ad2595df97b5dd5a9b8e16c917e3e3cbedc6 100755 (executable)
@@ -619,9 +619,9 @@ def save_configuration(profile_path, profile_name, configuration, forced=False):
     if os.path.isfile(setup_path) and not forced:
         raise AutorandrException('Refusing to overwrite config "{}" without passing "--force"!'.format(profile_name))
 
-    with open(os.path.join(profile_path, "config"), "w") as config:
+    with open(config_path, "w") as config:
         output_configuration(configuration, config)
-    with open(os.path.join(profile_path, "setup"), "w") as setup:
+    with open(setup_path, "w") as setup:
         output_setup(configuration, setup)
 
 
@@ -1233,11 +1233,10 @@ def main(argv):
                 "PROFILE_FOLDER": profile_folder,
                 "MONITORS": ":".join(enabled_monitors(config)),
             })
+        except AutorandrException as e:
+            raise e
         except Exception as e:
-            if isinstance(e, AutorandrException):
-                raise e
-            else:
-                raise AutorandrException("Failed to save current configuration as profile '%s'" % (options["--save"],), e)
+            raise AutorandrException("Failed to save current configuration as profile '%s'" % (options["--save"],), e)
         print("Saved current configuration as profile '%s'" % options["--save"])
         sys.exit(0)