git » abk » commit a170809

Replace os.path.join with manual concatenation.

author
2005-03-02 23:44:33 UTC
committer
2005-03-02 23:44:33 UTC
parent 62a30f2d71837ada0329d005be91ca5b6e98bb50

Replace os.path.join with manual concatenation.
os.path.join() has a nasty behaviour when a path begins with '/', so it's
better to do manual concatenation instead.

abk +10 -5

diff --git a/abk b/abk
index 72a015e..2d1f3d8 100644
--- a/abk
+++ b/abk
@@ -231,10 +231,12 @@ class index_file:
 		tree = os.walk(root, topdown = True)
 		for path, childs, files in tree:
 			for f in files:
-				name = os.path.join(path, f)
+				#name = os.path.join(path, f)
+				name = path + '/' + f
 				self.put_file(name)
 			for c in childs:
-				name = os.path.join(path, c)
+				#name = os.path.join(path, c)
+				name = path + '/' + c
 				self.put_file(name)
 
 
@@ -293,14 +295,16 @@ def make_sync(src_path, srcidx_path, dst_path, dstidx_path):
 		if f not in dstidx.names or \
 				not srcidx.db[f].cmp_data(dstidx.db[f]):
 			# files missing in destination, or data changed
-			dst = os.path.join(dst_path, f)
+			#dst = os.path.join(dst_path, f)
+			dst = dst_path + '/' + f
 			print 'data\t', f, dst
 			quiet_unlink(dst)
 			srcidx.db[f].copy_file(dst)
 			update_files.append((f, dst))
 		elif not srcidx.db[f].cmp_mdata(dstidx.db[f]):
 			# metadata changed
-			dst = os.path.join(dst_path, f)
+			#dst = os.path.join(dst_path, f)
+			dst = dst_path + '/' + f
 			print 'mdata\t', f, dst
 			update_files.append((f, dst))
 		
@@ -323,7 +327,8 @@ def make_sync(src_path, srcidx_path, dst_path, dstidx_path):
 	for f in dstidx.names:
 		if f not in srcidx.names:
 			# files in destination and not in source
-			dst = os.path.join(dst_path, f)
+			#dst = os.path.join(dst_path, f)
+			dst = dst_path + '/' + f
 			print 'unlink\t', f, dst
 			force_unlink(dst, dstidx.db[f].type)