Improve a few uses of pathclass.
This commit is contained in:
parent
f2190b9bfb
commit
90f14e04f8
1 changed files with 7 additions and 7 deletions
|
@ -556,7 +556,7 @@ def copy_file(
|
||||||
log.debug('Closing dest handle.')
|
log.debug('Closing dest handle.')
|
||||||
destination_handle.close()
|
destination_handle.close()
|
||||||
log.debug('Copying metadata.')
|
log.debug('Copying metadata.')
|
||||||
shutil.copystat(source.absolute_path, destination.absolute_path)
|
shutil.copystat(source, destination)
|
||||||
results.written = True
|
results.written = True
|
||||||
|
|
||||||
if verify_hash:
|
if verify_hash:
|
||||||
|
@ -712,12 +712,9 @@ def new_root(filepath, root):
|
||||||
I use this so that my G: drive can have backups from my C: and D: drives
|
I use this so that my G: drive can have backups from my C: and D: drives
|
||||||
while preserving directory structure in G:\\D and G:\\C.
|
while preserving directory structure in G:\\D and G:\\C.
|
||||||
'''
|
'''
|
||||||
filepath = pathclass.Path(filepath).absolute_path
|
filepath = pathclass.Path(filepath).absolute_path.replace(':', os.sep)
|
||||||
root = pathclass.Path(root).absolute_path
|
new_path = pathclass.Path(root).join(filepath)
|
||||||
filepath = filepath.replace(':', os.sep)
|
return new_path
|
||||||
filepath = os.path.normpath(filepath)
|
|
||||||
filepath = os.path.join(root, filepath)
|
|
||||||
return pathclass.Path(filepath)
|
|
||||||
|
|
||||||
def normalize(text):
|
def normalize(text):
|
||||||
'''
|
'''
|
||||||
|
@ -746,6 +743,9 @@ def verify_hash(
|
||||||
known_size:
|
known_size:
|
||||||
Optional, should be the previously known integer number of bytes.
|
Optional, should be the previously known integer number of bytes.
|
||||||
This makes failing the file much easier if the sizes differ.
|
This makes failing the file much easier if the sizes differ.
|
||||||
|
|
||||||
|
**hash_kwargs:
|
||||||
|
Passed into `hash_file`.
|
||||||
'''
|
'''
|
||||||
path = pathclass.Path(path)
|
path = pathclass.Path(path)
|
||||||
path.assert_is_file()
|
path.assert_is_file()
|
||||||
|
|
Loading…
Reference in a new issue