Browse code

* s3cmd: Path separator conversion on Windows hosts.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@401 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2009/12/09 20:11:08
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+2009-12-10  Michal Ludvig  <mludvig@logix.net.nz>
2
+
3
+	* s3cmd: Path separator conversion on Windows hosts.
4
+
1 5
 2009-10-08  Michal Ludvig  <mludvig@logix.net.nz>
2 6
 
3 7
 	* Released version 0.9.9.91
... ...
@@ -639,6 +639,9 @@ def _get_filelist_local(local_uri):
639 639
 				## for now skip over
640 640
 				continue
641 641
 			relative_file = unicodise(os.path.join(rel_root, f))
642
+			if os.path.sep != "/":
643
+				# Convert non-unix dir separators to '/'
644
+				relative_file = "/".join(relative_file.split(os.path.sep))
642 645
 			if cfg.urlencoding_mode == "normal":
643 646
 				relative_file = replace_nonprintables(relative_file)
644 647
 			if relative_file.startswith('./'):
... ...
@@ -738,6 +741,10 @@ def _compare_filelists(src_list, dst_list, src_is_local_and_dst_is_remote):
738 738
 	cfg = Config()
739 739
 	exists_list = SortedDict(ignore_case = False)
740 740
 
741
+	debug("Comparing filelists (src_is_local_and_dst_is_remote=%s)" % src_is_local_and_dst_is_remote)
742
+	debug("src_list.keys: %s" % src_list.keys())
743
+	debug("dst_list.keys: %s" % dst_list.keys())
744
+
741 745
 	for file in src_list.keys():
742 746
 		debug(u"CHECK: %s" % file)
743 747
 		if dst_list.has_key(file):
... ...
@@ -817,7 +824,10 @@ def cmd_sync_remote2local(args):
817 817
 		if destination_base[-1] != os.path.sep:
818 818
 			destination_base += os.path.sep
819 819
 		for key in remote_list:
820
-			remote_list[key]['local_filename'] = deunicodise(destination_base + key)
820
+			local_filename = destination_base + key
821
+			if os.path.sep != "/":
822
+				local_filename = os.path.sep.join(local_filename.split("/"))
823
+			remote_list[key]['local_filename'] = deunicodise(local_filename)
821 824
 
822 825
 	if cfg.dry_run:
823 826
 		for key in exclude_list: