Menu

#1 os.path.commonprefix

open
nobody
None
5
2009-09-25
2009-09-25
No

os.path.commonprefix(["/ab","/ac"]) returns '/a',
so, something like the following patch would be applied:

--- gxpbin/xmake 18 Sep 2009 15:44:13 -0000 1.44
+++ gxpbin/xmake 25 Sep 2009 10:38:30 -0000
@@ -1185,7 +1185,7 @@
# say real_from_dir = /a/b/x/y
real_from_dir = os.path.realpath(from_dir)
# common = /a/b/
- common = os.path.commonprefix([real_f, real_from_dir])
+ common = os.path.dirname(os.path.commonprefix([real_f, real_from_dir]))
d = real_f
base = ""
# we then compute path from common -> f (i.e., d/e/f part)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB