##// END OF EJS Templates
pathutil: demote two local functions to just be forwards...
Augie Fackler -
r25286:127a11f7 default
parent child Browse files
Show More
@@ -188,52 +188,8 b' def normasprefix(path):'
188 else:
188 else:
189 return path
189 return path
190
190
191 def join(*args):
191 # forward two methods from posixpath that do what we need, but we'd
192 '''Join two or more pathname components, inserting '/' as needed.
192 # rather not let our internals know that we're thinking in posix terms
193
193 # - instead we'll let them be oblivious.
194 Based on the posix os.path.join() implementation.
194 join = posixpath.join
195
195 dirname = posixpath.dirname
196 >>> join('foo', 'bar')
197 'foo/bar'
198 >>> join('/foo', 'bar')
199 '/foo/bar'
200 >>> join('foo', '/bar')
201 '/bar'
202 >>> join('foo', 'bar/')
203 'foo/bar/'
204 >>> join('foo', 'bar', 'gah')
205 'foo/bar/gah'
206 >>> join('foo')
207 'foo'
208 >>> join('', 'foo')
209 'foo'
210 >>> join('foo/', 'bar')
211 'foo/bar'
212 >>> join('', '', '')
213 ''
214 >>> join ('foo', '', '', 'bar')
215 'foo/bar'
216 '''
217 return posixpath.join(*args)
218
219 def dirname(path):
220 '''returns the directory portion of the given path
221
222 Based on the posix os.path.split() implementation.
223
224 >>> dirname('foo')
225 ''
226 >>> dirname('foo/')
227 'foo'
228 >>> dirname('foo/bar')
229 'foo'
230 >>> dirname('/foo')
231 '/'
232 >>> dirname('/foo/bar')
233 '/foo'
234 >>> dirname('/foo//bar/poo')
235 '/foo//bar'
236 >>> dirname('/foo//bar')
237 '/foo'
238 '''
239 return posixpath.dirname(path)
General Comments 0
You need to be logged in to leave comments. Login now