From 5d11c7954da81cba321c8716e4b0b76bcb11bf73 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Mon, 25 Apr 2022 09:02:58 -0500 Subject: [PATCH] Resolve Windows-specific create issues --- dotbot/plugins/create.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dotbot/plugins/create.py b/dotbot/plugins/create.py index 6fd660f..85557a6 100644 --- a/dotbot/plugins/create.py +++ b/dotbot/plugins/create.py @@ -21,7 +21,7 @@ class Create(dotbot.Plugin): success = True defaults = self._context.defaults().get("create", {}) for key in paths: - path = os.path.expandvars(os.path.expanduser(key)) + path = os.path.abspath(os.path.expandvars(os.path.expanduser(key))) mode = defaults.get("mode", 0o777) # same as the default for os.makedirs if isinstance(paths, dict): options = paths[key] @@ -48,6 +48,9 @@ class Create(dotbot.Plugin): try: self._log.lowinfo("Creating path %s" % path) os.makedirs(path, mode) + # On Windows, the *mode* argument to `os.makedirs()` is ignored. + # The mode must be set explicitly in a follow-up call. + os.chmod(path, mode) except OSError: self._log.warning("Failed to create path %s" % path) success = False