##// END OF EJS Templates
vfs: add a 'reljoin' function for joining relative paths...
Pierre-Yves David -
r23581:aed981c7 default
parent child Browse files
Show More
@@ -261,6 +261,13 class abstractvfs(object):
261 def islink(self, path=None):
261 def islink(self, path=None):
262 return os.path.islink(self.join(path))
262 return os.path.islink(self.join(path))
263
263
264 def reljoin(self, *paths):
265 """join various elements of a path together (as os.path.join would do)
266
267 The vfs base is not injected so that path stay relative. This exists
268 to allow handling of strange encoding if needed."""
269 return os.path.join(*paths)
270
264 def lexists(self, path=None):
271 def lexists(self, path=None):
265 return os.path.lexists(self.join(path))
272 return os.path.lexists(self.join(path))
266
273
@@ -200,8 +200,8 class transaction(object):
200 return
200 return
201 dirname, filename = os.path.split(file)
201 dirname, filename = os.path.split(file)
202 backupfilename = "%s.backup.%s" % (self.journal, filename)
202 backupfilename = "%s.backup.%s" % (self.journal, filename)
203 backupfile = os.path.join(dirname, backupfilename)
204 vfs = self._vfsmap[location]
203 vfs = self._vfsmap[location]
204 backupfile = vfs.reljoin(dirname, backupfilename)
205 if vfs.exists(file):
205 if vfs.exists(file):
206 filepath = vfs.join(file)
206 filepath = vfs.join(file)
207 backuppath = vfs.join(backupfile)
207 backuppath = vfs.join(backupfile)
General Comments 0
You need to be logged in to leave comments. Login now