so move it out of the loop.
Matt Domsch authored on 2013/12/06 04:27:40... | ... |
@@ -989,7 +989,7 @@ def cmd_sync_remote2local(args): |
989 | 989 |
def local_copy(copy_pairs, destination_base): |
990 | 990 |
# Do NOT hardlink local files by default, that'd be silly |
991 | 991 |
# For instance all empty files would become hardlinked together! |
992 |
- |
|
992 |
+ encoding = sys.getfilesystemencoding() |
|
993 | 993 |
failed_copy_list = FileDict() |
994 | 994 |
for (src_obj, dst1, relative_file) in copy_pairs: |
995 | 995 |
src_file = os.path.join(destination_base, dst1) |
... | ... |
@@ -1000,7 +1000,6 @@ def local_copy(copy_pairs, destination_base): |
1000 | 1000 |
debug("MKDIR %s" % dst_dir) |
1001 | 1001 |
os.makedirs(dst_dir) |
1002 | 1002 |
debug(u"Copying %s to %s" % (src_file, dst_file)) |
1003 |
- encoding = sys.getfilesystemencoding() |
|
1004 | 1003 |
shutil.copy2(src_file.encode(encoding), dst_file.encode(encoding)) |
1005 | 1004 |
except (IOError, OSError), e: |
1006 | 1005 |
warning(u'Unable to hardlink or copy files %s -> %s: %s' % (src_file, dst_file, e)) |