Resolve Windows-specific create issues
This commit is contained in:
parent
b59b3af448
commit
5d11c7954d
1 changed files with 4 additions and 1 deletions
|
@ -21,7 +21,7 @@ class Create(dotbot.Plugin):
|
||||||
success = True
|
success = True
|
||||||
defaults = self._context.defaults().get("create", {})
|
defaults = self._context.defaults().get("create", {})
|
||||||
for key in paths:
|
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
|
mode = defaults.get("mode", 0o777) # same as the default for os.makedirs
|
||||||
if isinstance(paths, dict):
|
if isinstance(paths, dict):
|
||||||
options = paths[key]
|
options = paths[key]
|
||||||
|
@ -48,6 +48,9 @@ class Create(dotbot.Plugin):
|
||||||
try:
|
try:
|
||||||
self._log.lowinfo("Creating path %s" % path)
|
self._log.lowinfo("Creating path %s" % path)
|
||||||
os.makedirs(path, mode)
|
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:
|
except OSError:
|
||||||
self._log.warning("Failed to create path %s" % path)
|
self._log.warning("Failed to create path %s" % path)
|
||||||
success = False
|
success = False
|
||||||
|
|
Loading…
Reference in a new issue