From 7840d53212c23118833dcda85347c4a80a2ba40e Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 6 Sep 2020 09:54:28 -0700 Subject: [PATCH] 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. --- voussoirkit/spinal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voussoirkit/spinal.py b/voussoirkit/spinal.py index 0fb3f79..ffc4341 100644 --- a/voussoirkit/spinal.py +++ b/voussoirkit/spinal.py @@ -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)