normalise paths for windows compat
This commit is contained in:
parent
4ec846cdad
commit
e985d310e2
|
@ -38,11 +38,13 @@ class Clean(dotbot.Plugin):
|
||||||
Cleans all the broken symbolic links in target if they point to
|
Cleans all the broken symbolic links in target if they point to
|
||||||
a subdirectory of the base directory or if forced to clean.
|
a subdirectory of the base directory or if forced to clean.
|
||||||
'''
|
'''
|
||||||
if not os.path.isdir(os.path.expandvars(os.path.expanduser(target))):
|
target_normalised = os.path.normpath(os.path.expandvars(os.path.expanduser(target)))
|
||||||
|
isdir = os.path.isdir(target_normalised)
|
||||||
|
if isdir is False:
|
||||||
self._log.debug('Ignoring nonexistent directory %s' % target)
|
self._log.debug('Ignoring nonexistent directory %s' % target)
|
||||||
return True
|
return True
|
||||||
for item in os.listdir(os.path.expandvars(os.path.expanduser(target))):
|
for item in os.listdir(target_normalised):
|
||||||
path = os.path.join(os.path.expandvars(os.path.expanduser(target)), item)
|
path = os.path.join(target_normalised, item)
|
||||||
if recursive and os.path.isdir(path):
|
if recursive and os.path.isdir(path):
|
||||||
# isdir implies not islink -- we don't want to descend into
|
# isdir implies not islink -- we don't want to descend into
|
||||||
# symlinked directories. okay to do a recursive call here
|
# symlinked directories. okay to do a recursive call here
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Create(dotbot.Plugin):
|
||||||
def _process_paths(self, paths):
|
def _process_paths(self, paths):
|
||||||
success = True
|
success = True
|
||||||
for path in paths:
|
for path in paths:
|
||||||
path = os.path.expandvars(os.path.expanduser(path))
|
path = os.path.normpath(os.path.expandvars(os.path.expanduser(path)))
|
||||||
success &= self._create(path)
|
success &= self._create(path)
|
||||||
if success:
|
if success:
|
||||||
self._log.info('All paths have been set up')
|
self._log.info('All paths have been set up')
|
||||||
|
|
Loading…
Reference in a new issue