1
0
Fork 0
mirror of synced 2024-11-22 08:15:34 -05:00

Resolve Windows-specific create issues

This commit is contained in:
Kurt McKee 2022-04-25 09:02:58 -05:00
parent b59b3af448
commit 5d11c7954d

View file

@ -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