@@ -492,7 +492,7 @@ def copy_file(from_path, to_path):
492492 to_path = add_unc (to_path )
493493
494494 # Strip the white spaces
495- from_path = norm ( from_path .strip () )
495+ from_path = from_path .strip ()
496496 to_path = to_path .strip ()
497497 # Errors will be captured when doing the validation
498498 if not os .path .exists (from_path ):
@@ -503,17 +503,19 @@ def copy_file(from_path, to_path):
503503 try :
504504 if os .path .isdir (from_path ):
505505 # Copy the whole directory structure
506+ if from_path .endswith ('/' ):
507+ from_path = from_path .rpartition ('/' )[0 ]
506508 folder_name = os .path .basename (from_path )
507509 to_path = os .path .join (to_path , folder_name )
508510 if os .path .exists (to_path ):
509- msg = norm ( to_path ) + ' is already existed and is replaced by ' + norm ( from_path )
511+ msg = to_path + ' is already existed and is replaced by ' + from_path
510512 error .append (Error (WARNING , msg ))
511513 copy_tree (from_path , to_path )
512514 else :
513515 file_name = os .path .basename (from_path )
514516 to_file_path = os .path .join (to_path , file_name )
515517 if os .path .exists (to_file_path ):
516- msg = norm ( to_file_path ) + ' is already existed and is replaced by ' + norm ( from_path )
518+ msg = to_file_path + ' is already existed and is replaced by ' + from_path
517519 error .append (Error (WARNING , msg ))
518520 shutil .copy2 (from_path , to_path )
519521 return error
0 commit comments