Move source.correct_case out of conditional.
The reasoning was that in the non-new_root case, the destination supplied by the user would either be the exact path of the new file, or the parent of the new file. Either way, the casing of source shouldn't matter since only the file itself is being created with the given casing. But, I realized, since we are doing makedirs in the event that the whole path leading up to destination doesn't exist, we should create it with the correct case according to the source. And that can occur regardless of new_root.
This commit is contained in:
parent
26eaac7119
commit
7840d53212
1 changed files with 1 additions and 1 deletions
|
@ -387,12 +387,12 @@ def copy_file(
|
|||
raise ValueError(message)
|
||||
|
||||
source = pathclass.Path(source)
|
||||
source.correct_case()
|
||||
|
||||
if not source.is_file:
|
||||
raise SourceNotFile(source)
|
||||
|
||||
if destination_new_root is not None:
|
||||
source.correct_case()
|
||||
destination = new_root(source, destination_new_root)
|
||||
destination = pathclass.Path(destination)
|
||||
|
||||
|
|
Loading…
Reference in a new issue