blob: 15212366057da308114bcf2e9d1fbf73478ca2ad [file] [log] [blame]
Guido van Rossum54f22ed2000-02-04 15:10:34 +00001"""Common operations on Posix pathnames.
2
3Instead of importing this module directly, import os and refer to
4this module as os.path. The "os.path" name is an alias for this
5module on Posix systems; on other systems (e.g. Mac, Windows),
6os.path provides the same operations in a manner specific to that
7platform, and is an alias to another module (e.g. macpath, ntpath).
8
9Some of this can actually be useful on non-Posix systems too, e.g.
10for manipulation of the pathname component of URLs.
Guido van Rossum346f7af1997-12-05 19:04:51 +000011"""
Guido van Rossumc6360141990-10-13 19:23:40 +000012
Guido van Rossumd3876d31996-07-23 03:47:28 +000013import os
Guido van Rossum40d93041990-10-21 16:17:34 +000014import stat
Jack Diederich7b604642006-08-26 18:42:06 +000015from genericpath import *
Guido van Rossumc6360141990-10-13 19:23:40 +000016
Skip Montanaroc62c81e2001-02-12 02:00:42 +000017__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
18 "basename","dirname","commonprefix","getsize","getmtime",
Georg Brandlf0de6a12005-08-22 18:02:59 +000019 "getatime","getctime","islink","exists","lexists","isdir","isfile",
20 "ismount","walk","expanduser","expandvars","normpath","abspath",
Neal Norwitz61cdac62003-01-03 18:01:57 +000021 "samefile","sameopenfile","samestat",
Skip Montanaro117910d2003-02-14 19:35:31 +000022 "curdir","pardir","sep","pathsep","defpath","altsep","extsep",
Martin v. Löwisbdec50f2004-06-08 08:29:33 +000023 "devnull","realpath","supports_unicode_filenames"]
Guido van Rossumc6360141990-10-13 19:23:40 +000024
Skip Montanaro117910d2003-02-14 19:35:31 +000025# strings representing various path-related bits and pieces
26curdir = '.'
27pardir = '..'
28extsep = '.'
29sep = '/'
30pathsep = ':'
31defpath = ':/bin:/usr/bin'
32altsep = None
Martin v. Löwisbdec50f2004-06-08 08:29:33 +000033devnull = '/dev/null'
Skip Montanaro117910d2003-02-14 19:35:31 +000034
Guido van Rossum7ac48781992-01-14 18:29:32 +000035# Normalize the case of a pathname. Trivial in Posix, string.lower on Mac.
36# On MS-DOS this may also turn slashes into backslashes; however, other
37# normalizations (such as optimizing '../' away) are not allowed
38# (another function should be defined to do that).
39
40def normcase(s):
Guido van Rossum346f7af1997-12-05 19:04:51 +000041 """Normalize case of pathname. Has no effect under Posix"""
42 return s
Guido van Rossum7ac48781992-01-14 18:29:32 +000043
44
Jeremy Hyltona05e2932000-06-28 14:48:01 +000045# Return whether a path is absolute.
Guido van Rossum7ac48781992-01-14 18:29:32 +000046# Trivial in Posix, harder on the Mac or MS-DOS.
47
48def isabs(s):
Guido van Rossum346f7af1997-12-05 19:04:51 +000049 """Test whether a path is absolute"""
Walter Dörwald77cdeaf2003-06-17 13:13:40 +000050 return s.startswith('/')
Guido van Rossum7ac48781992-01-14 18:29:32 +000051
52
Barry Warsaw384d2491997-02-18 21:53:25 +000053# Join pathnames.
54# Ignore the previous parts if a part is absolute.
Guido van Rossum4d0fdc31991-08-16 13:27:58 +000055# Insert a '/' unless the first part is empty or already ends in '/'.
Guido van Rossum7ac48781992-01-14 18:29:32 +000056
Barry Warsaw384d2491997-02-18 21:53:25 +000057def join(a, *p):
Guido van Rossum346f7af1997-12-05 19:04:51 +000058 """Join two or more pathname components, inserting '/' as needed"""
59 path = a
60 for b in p:
Walter Dörwald77cdeaf2003-06-17 13:13:40 +000061 if b.startswith('/'):
Guido van Rossum346f7af1997-12-05 19:04:51 +000062 path = b
Walter Dörwald77cdeaf2003-06-17 13:13:40 +000063 elif path == '' or path.endswith('/'):
64 path += b
Guido van Rossum346f7af1997-12-05 19:04:51 +000065 else:
Walter Dörwald77cdeaf2003-06-17 13:13:40 +000066 path += '/' + b
Guido van Rossum346f7af1997-12-05 19:04:51 +000067 return path
Guido van Rossumc6360141990-10-13 19:23:40 +000068
69
Guido van Rossum26847381992-03-31 18:54:35 +000070# Split a path in head (everything up to the last '/') and tail (the
Guido van Rossuma89b1ba1995-09-01 20:32:21 +000071# rest). If the path ends in '/', tail will be empty. If there is no
72# '/' in the path, head will be empty.
73# Trailing '/'es are stripped from head unless it is the root.
Guido van Rossum7ac48781992-01-14 18:29:32 +000074
Guido van Rossumc6360141990-10-13 19:23:40 +000075def split(p):
Tim Peters2344fae2001-01-15 00:50:52 +000076 """Split a pathname. Returns tuple "(head, tail)" where "tail" is
Fred Drakec0ab93e2000-09-28 16:22:52 +000077 everything after the final slash. Either part may be empty."""
Fred Drake22fb8392000-09-28 15:04:39 +000078 i = p.rfind('/') + 1
Guido van Rossum346f7af1997-12-05 19:04:51 +000079 head, tail = p[:i], p[i:]
Fred Drake8152d322000-12-12 23:20:45 +000080 if head and head != '/'*len(head):
Walter Dörwald77cdeaf2003-06-17 13:13:40 +000081 head = head.rstrip('/')
Guido van Rossum346f7af1997-12-05 19:04:51 +000082 return head, tail
Guido van Rossumc6360141990-10-13 19:23:40 +000083
84
Guido van Rossum4d0fdc31991-08-16 13:27:58 +000085# Split a path in root and extension.
Guido van Rossum422869a1996-08-20 20:24:17 +000086# The extension is everything starting at the last dot in the last
Guido van Rossum4d0fdc31991-08-16 13:27:58 +000087# pathname component; the root is everything before that.
Guido van Rossum7ac48781992-01-14 18:29:32 +000088# It is always true that root + ext == p.
89
Guido van Rossum4d0fdc31991-08-16 13:27:58 +000090def splitext(p):
Guido van Rossum346f7af1997-12-05 19:04:51 +000091 """Split the extension from a pathname. Extension is everything from the
Fred Drakec0ab93e2000-09-28 16:22:52 +000092 last dot to the end. Returns "(root, ext)", either part may be empty."""
Martin v. Löwisde333792002-12-12 20:30:20 +000093 i = p.rfind('.')
94 if i<=p.rfind('/'):
95 return p, ''
96 else:
97 return p[:i], p[i:]
Guido van Rossum4d0fdc31991-08-16 13:27:58 +000098
99
Guido van Rossum221df241995-08-07 20:17:55 +0000100# Split a pathname into a drive specification and the rest of the
101# path. Useful on DOS/Windows/NT; on Unix, the drive is always empty.
102
103def splitdrive(p):
Tim Peters2344fae2001-01-15 00:50:52 +0000104 """Split a pathname into drive and path. On Posix, drive is always
Fred Drakec0ab93e2000-09-28 16:22:52 +0000105 empty."""
Guido van Rossum346f7af1997-12-05 19:04:51 +0000106 return '', p
Guido van Rossum221df241995-08-07 20:17:55 +0000107
108
Georg Brandl65ad0432006-10-12 13:08:16 +0000109# Return the tail (basename) part of a path, same as split(path)[1].
Guido van Rossum7ac48781992-01-14 18:29:32 +0000110
Guido van Rossumc6360141990-10-13 19:23:40 +0000111def basename(p):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000112 """Returns the final component of a pathname"""
Georg Brandl65ad0432006-10-12 13:08:16 +0000113 i = p.rfind('/') + 1
114 return p[i:]
Guido van Rossumc6360141990-10-13 19:23:40 +0000115
116
Georg Brandl65ad0432006-10-12 13:08:16 +0000117# Return the head (dirname) part of a path, same as split(path)[0].
Guido van Rossumc629d341992-11-05 10:43:02 +0000118
119def dirname(p):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000120 """Returns the directory component of a pathname"""
Georg Brandl65ad0432006-10-12 13:08:16 +0000121 i = p.rfind('/') + 1
122 head = p[:i]
123 if head and head != '/'*len(head):
124 head = head.rstrip('/')
125 return head
Guido van Rossumc629d341992-11-05 10:43:02 +0000126
127
Guido van Rossum7ac48781992-01-14 18:29:32 +0000128# Is a path a symbolic link?
Guido van Rossumd3876d31996-07-23 03:47:28 +0000129# This will always return false on systems where os.lstat doesn't exist.
Guido van Rossum7ac48781992-01-14 18:29:32 +0000130
131def islink(path):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000132 """Test whether a path is a symbolic link"""
133 try:
134 st = os.lstat(path)
135 except (os.error, AttributeError):
Guido van Rossum8ca162f2002-04-07 06:36:23 +0000136 return False
Raymond Hettinger32200ae2002-06-01 19:51:15 +0000137 return stat.S_ISLNK(st.st_mode)
Guido van Rossum7ac48781992-01-14 18:29:32 +0000138
Johannes Gijsbersae882f72004-08-30 10:19:56 +0000139# Being true for dangling symbolic links is also useful.
140
141def lexists(path):
142 """Test whether a path exists. Returns True for broken symbolic links"""
143 try:
144 st = os.lstat(path)
145 except os.error:
146 return False
147 return True
148
149
Guido van Rossumd3778f91991-11-12 15:37:40 +0000150# Are two filenames really pointing to the same file?
Guido van Rossum7ac48781992-01-14 18:29:32 +0000151
Guido van Rossumd3778f91991-11-12 15:37:40 +0000152def samefile(f1, f2):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000153 """Test whether two pathnames reference the same actual file"""
154 s1 = os.stat(f1)
155 s2 = os.stat(f2)
156 return samestat(s1, s2)
Guido van Rossumd3778f91991-11-12 15:37:40 +0000157
158
159# Are two open files really referencing the same file?
160# (Not necessarily the same file descriptor!)
Guido van Rossum7ac48781992-01-14 18:29:32 +0000161
Guido van Rossumd3778f91991-11-12 15:37:40 +0000162def sameopenfile(fp1, fp2):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000163 """Test whether two open file objects reference the same file"""
164 s1 = os.fstat(fp1)
165 s2 = os.fstat(fp2)
166 return samestat(s1, s2)
Guido van Rossumd3778f91991-11-12 15:37:40 +0000167
168
169# Are two stat buffers (obtained from stat, fstat or lstat)
170# describing the same file?
Guido van Rossum7ac48781992-01-14 18:29:32 +0000171
Guido van Rossumd3778f91991-11-12 15:37:40 +0000172def samestat(s1, s2):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000173 """Test whether two stat buffers reference the same file"""
Raymond Hettinger32200ae2002-06-01 19:51:15 +0000174 return s1.st_ino == s2.st_ino and \
175 s1.st_dev == s2.st_dev
Guido van Rossumc6360141990-10-13 19:23:40 +0000176
177
178# Is a path a mount point?
Guido van Rossumd3876d31996-07-23 03:47:28 +0000179# (Does this work for all UNIXes? Is it even guaranteed to work by Posix?)
Guido van Rossum7ac48781992-01-14 18:29:32 +0000180
Guido van Rossumc6360141990-10-13 19:23:40 +0000181def ismount(path):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000182 """Test whether a path is a mount point"""
183 try:
184 s1 = os.stat(path)
185 s2 = os.stat(join(path, '..'))
186 except os.error:
Tim Petersbc0e9102002-04-04 22:55:58 +0000187 return False # It doesn't exist -- so not a mount point :-)
Raymond Hettinger32200ae2002-06-01 19:51:15 +0000188 dev1 = s1.st_dev
189 dev2 = s2.st_dev
Guido van Rossum346f7af1997-12-05 19:04:51 +0000190 if dev1 != dev2:
Tim Petersbc0e9102002-04-04 22:55:58 +0000191 return True # path/.. on a different device as path
Raymond Hettinger32200ae2002-06-01 19:51:15 +0000192 ino1 = s1.st_ino
193 ino2 = s2.st_ino
Guido van Rossum346f7af1997-12-05 19:04:51 +0000194 if ino1 == ino2:
Tim Petersbc0e9102002-04-04 22:55:58 +0000195 return True # path/.. is the same i-node as path
196 return False
Guido van Rossumc6360141990-10-13 19:23:40 +0000197
198
199# Directory tree walk.
Guido van Rossum7ac48781992-01-14 18:29:32 +0000200# For each directory under top (including top itself, but excluding
201# '.' and '..'), func(arg, dirname, filenames) is called, where
202# dirname is the name of the directory and filenames is the list
Guido van Rossum346f7af1997-12-05 19:04:51 +0000203# of files (and subdirectories etc.) in the directory.
Guido van Rossum7ac48781992-01-14 18:29:32 +0000204# The func may modify the filenames list, to implement a filter,
Guido van Rossumc6360141990-10-13 19:23:40 +0000205# or to impose a different order of visiting.
Guido van Rossum7ac48781992-01-14 18:29:32 +0000206
Guido van Rossumc6360141990-10-13 19:23:40 +0000207def walk(top, func, arg):
Tim Peterscf5e6a42001-10-10 04:16:20 +0000208 """Directory tree walk with callback function.
209
210 For each directory in the directory tree rooted at top (including top
211 itself, but excluding '.' and '..'), call func(arg, dirname, fnames).
212 dirname is the name of the directory, and fnames a list of the names of
213 the files and subdirectories in dirname (excluding '.' and '..'). func
214 may modify the fnames list in-place (e.g. via del or slice assignment),
215 and walk will only recurse into the subdirectories whose names remain in
216 fnames; this can be used to implement a filter, or to impose a specific
217 order of visiting. No semantics are defined for, or required of, arg,
218 beyond that arg is always passed to func. It can be used, e.g., to pass
219 a filename pattern, or a mutable object designed to accumulate
220 statistics. Passing None for arg is common."""
221
Guido van Rossum346f7af1997-12-05 19:04:51 +0000222 try:
223 names = os.listdir(top)
224 except os.error:
225 return
226 func(arg, top, names)
Guido van Rossum346f7af1997-12-05 19:04:51 +0000227 for name in names:
Tim Peters2344fae2001-01-15 00:50:52 +0000228 name = join(top, name)
Guido van Rossuma490d582001-04-16 18:12:04 +0000229 try:
230 st = os.lstat(name)
231 except os.error:
232 continue
Neal Norwitzec7cf132002-06-06 18:16:14 +0000233 if stat.S_ISDIR(st.st_mode):
Tim Peters2344fae2001-01-15 00:50:52 +0000234 walk(name, func, arg)
Guido van Rossum7ac48781992-01-14 18:29:32 +0000235
236
237# Expand paths beginning with '~' or '~user'.
238# '~' means $HOME; '~user' means that user's home directory.
239# If the path doesn't begin with '~', or if the user or $HOME is unknown,
240# the path is returned unchanged (leaving error reporting to whatever
241# function is called with the expanded path as argument).
242# See also module 'glob' for expansion of *, ? and [...] in pathnames.
243# (A function should also be defined to do full *sh-style environment
244# variable expansion.)
245
246def expanduser(path):
Tim Peters2344fae2001-01-15 00:50:52 +0000247 """Expand ~ and ~user constructions. If user or $HOME is unknown,
Fred Drakec0ab93e2000-09-28 16:22:52 +0000248 do nothing."""
Walter Dörwald77cdeaf2003-06-17 13:13:40 +0000249 if not path.startswith('~'):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000250 return path
Walter Dörwalda9da5ae2003-06-19 10:21:14 +0000251 i = path.find('/', 1)
252 if i < 0:
253 i = len(path)
Guido van Rossum346f7af1997-12-05 19:04:51 +0000254 if i == 1:
Walter Dörwalda9da5ae2003-06-19 10:21:14 +0000255 if 'HOME' not in os.environ:
Neal Norwitz609ba812002-09-05 21:08:25 +0000256 import pwd
Walter Dörwald77cdeaf2003-06-17 13:13:40 +0000257 userhome = pwd.getpwuid(os.getuid()).pw_dir
Neal Norwitz609ba812002-09-05 21:08:25 +0000258 else:
259 userhome = os.environ['HOME']
Guido van Rossum346f7af1997-12-05 19:04:51 +0000260 else:
261 import pwd
262 try:
263 pwent = pwd.getpwnam(path[1:i])
264 except KeyError:
265 return path
Walter Dörwald77cdeaf2003-06-17 13:13:40 +0000266 userhome = pwent.pw_dir
Georg Brandl8d1e5bf2006-09-30 09:13:21 +0000267 userhome = userhome.rstrip('/')
Guido van Rossum346f7af1997-12-05 19:04:51 +0000268 return userhome + path[i:]
Guido van Rossum4732ccf1992-08-09 13:54:50 +0000269
270
271# Expand paths containing shell variable substitutions.
Guido van Rossumb6775db1994-08-01 11:34:53 +0000272# This expands the forms $variable and ${variable} only.
Jeremy Hyltona05e2932000-06-28 14:48:01 +0000273# Non-existent variables are left unchanged.
Guido van Rossumb6775db1994-08-01 11:34:53 +0000274
275_varprog = None
Guido van Rossum4732ccf1992-08-09 13:54:50 +0000276
277def expandvars(path):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000278 """Expand shell variables of form $var and ${var}. Unknown variables
Fred Drakec0ab93e2000-09-28 16:22:52 +0000279 are left unchanged."""
Guido van Rossum346f7af1997-12-05 19:04:51 +0000280 global _varprog
281 if '$' not in path:
282 return path
283 if not _varprog:
284 import re
285 _varprog = re.compile(r'\$(\w+|\{[^}]*\})')
286 i = 0
Guido van Rossum8ca162f2002-04-07 06:36:23 +0000287 while True:
Guido van Rossum346f7af1997-12-05 19:04:51 +0000288 m = _varprog.search(path, i)
289 if not m:
290 break
291 i, j = m.span(0)
292 name = m.group(1)
Walter Dörwald77cdeaf2003-06-17 13:13:40 +0000293 if name.startswith('{') and name.endswith('}'):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000294 name = name[1:-1]
Raymond Hettinger54f02222002-06-01 14:18:47 +0000295 if name in os.environ:
Guido van Rossum346f7af1997-12-05 19:04:51 +0000296 tail = path[j:]
297 path = path[:i] + os.environ[name]
298 i = len(path)
Walter Dörwald77cdeaf2003-06-17 13:13:40 +0000299 path += tail
Guido van Rossum346f7af1997-12-05 19:04:51 +0000300 else:
301 i = j
302 return path
Guido van Rossumc629d341992-11-05 10:43:02 +0000303
304
305# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
306# It should be understood that this may change the meaning of the path
307# if it contains symbolic links!
308
309def normpath(path):
Guido van Rossum346f7af1997-12-05 19:04:51 +0000310 """Normalize path, eliminating double slashes, etc."""
Skip Montanaro018dfae2000-07-19 17:09:51 +0000311 if path == '':
312 return '.'
Marc-André Lemburgbf222c92001-01-29 11:29:44 +0000313 initial_slashes = path.startswith('/')
314 # POSIX allows one or two initial slashes, but treats three or more
315 # as single slash.
Tim Peters658cba62001-02-09 20:06:00 +0000316 if (initial_slashes and
Marc-André Lemburgbf222c92001-01-29 11:29:44 +0000317 path.startswith('//') and not path.startswith('///')):
318 initial_slashes = 2
Fred Drake22fb8392000-09-28 15:04:39 +0000319 comps = path.split('/')
Skip Montanaro018dfae2000-07-19 17:09:51 +0000320 new_comps = []
321 for comp in comps:
322 if comp in ('', '.'):
323 continue
Marc-André Lemburgbf222c92001-01-29 11:29:44 +0000324 if (comp != '..' or (not initial_slashes and not new_comps) or
Skip Montanaro018dfae2000-07-19 17:09:51 +0000325 (new_comps and new_comps[-1] == '..')):
326 new_comps.append(comp)
327 elif new_comps:
328 new_comps.pop()
329 comps = new_comps
Fred Drake22fb8392000-09-28 15:04:39 +0000330 path = '/'.join(comps)
Marc-André Lemburgbf222c92001-01-29 11:29:44 +0000331 if initial_slashes:
332 path = '/'*initial_slashes + path
Skip Montanaro018dfae2000-07-19 17:09:51 +0000333 return path or '.'
Guido van Rossume294cf61999-01-29 18:05:18 +0000334
335
Guido van Rossume294cf61999-01-29 18:05:18 +0000336def abspath(path):
Guido van Rossum54f22ed2000-02-04 15:10:34 +0000337 """Return an absolute path."""
Guido van Rossume294cf61999-01-29 18:05:18 +0000338 if not isabs(path):
339 path = join(os.getcwd(), path)
340 return normpath(path)
Guido van Rossum83eeef42001-09-17 15:16:09 +0000341
342
343# Return a canonical path (i.e. the absolute location of a file on the
344# filesystem).
345
346def realpath(filename):
347 """Return the canonical path of the specified filename, eliminating any
348symbolic links encountered in the path."""
Johannes Gijsbers4ec40642004-08-14 15:01:53 +0000349 if isabs(filename):
350 bits = ['/'] + filename.split('/')[1:]
351 else:
Georg Brandl268e61c2005-06-03 14:28:50 +0000352 bits = [''] + filename.split('/')
Tim Petersa45cacf2004-08-20 03:47:14 +0000353
Guido van Rossum83eeef42001-09-17 15:16:09 +0000354 for i in range(2, len(bits)+1):
355 component = join(*bits[0:i])
Brett Cannonf50299c2004-07-10 22:55:15 +0000356 # Resolve symbolic links.
Brett Cannondfa5d952004-07-11 19:16:21 +0000357 if islink(component):
Brett Cannonf50299c2004-07-10 22:55:15 +0000358 resolved = _resolve_link(component)
359 if resolved is None:
360 # Infinite loop -- return original component + rest of the path
Johannes Gijsbers4ec40642004-08-14 15:01:53 +0000361 return abspath(join(*([component] + bits[i:])))
Brett Cannonf50299c2004-07-10 22:55:15 +0000362 else:
363 newpath = join(*([resolved] + bits[i:]))
Tim Petersa45cacf2004-08-20 03:47:14 +0000364 return realpath(newpath)
Tim Petersb64bec32001-09-18 02:26:39 +0000365
Johannes Gijsbers4ec40642004-08-14 15:01:53 +0000366 return abspath(filename)
Tim Petersa45cacf2004-08-20 03:47:14 +0000367
Brett Cannonf50299c2004-07-10 22:55:15 +0000368
369def _resolve_link(path):
370 """Internal helper function. Takes a path and follows symlinks
Tim Peters182b5ac2004-07-18 06:16:08 +0000371 until we either arrive at something that isn't a symlink, or
Brett Cannonf50299c2004-07-10 22:55:15 +0000372 encounter a path we've seen before (meaning that there's a loop).
373 """
374 paths_seen = []
375 while islink(path):
Brett Cannondfa5d952004-07-11 19:16:21 +0000376 if path in paths_seen:
Brett Cannonf50299c2004-07-10 22:55:15 +0000377 # Already seen this path, so we must have a symlink loop
378 return None
Brett Cannondfa5d952004-07-11 19:16:21 +0000379 paths_seen.append(path)
Brett Cannonf50299c2004-07-10 22:55:15 +0000380 # Resolve where the link points to
Brett Cannondfa5d952004-07-11 19:16:21 +0000381 resolved = os.readlink(path)
Andrew M. Kuchlingc75f1122004-08-02 14:54:16 +0000382 if not isabs(resolved):
Brett Cannonf50299c2004-07-10 22:55:15 +0000383 dir = dirname(path)
384 path = normpath(join(dir, resolved))
385 else:
386 path = normpath(resolved)
387 return path
388
Just van Rossum2d4e9882003-07-17 15:11:49 +0000389supports_unicode_filenames = False