mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
In a number of places code still revers
to "sys.platform == 'mac'" and that is dead code because it refers to a platform that is no longer supported (and hasn't been supported for several releases). Fixes issue #7908 for the trunk.
This commit is contained in:
parent
a8157183b8
commit
9545a23c7f
30 changed files with 70 additions and 267 deletions
|
@ -721,16 +721,13 @@ def AskFileForSave(
|
|||
if issubclass(tpwanted, Carbon.File.FSSpec):
|
||||
return tpwanted(rr.selection[0])
|
||||
if issubclass(tpwanted, (str, unicode)):
|
||||
if sys.platform == 'mac':
|
||||
fullpath = rr.selection[0].as_pathname()
|
||||
else:
|
||||
# This is gross, and probably incorrect too
|
||||
vrefnum, dirid, name = rr.selection[0].as_tuple()
|
||||
pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, ''))
|
||||
pardir_fsr = Carbon.File.FSRef(pardir_fss)
|
||||
pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8
|
||||
name_utf8 = unicode(name, 'macroman').encode('utf8')
|
||||
fullpath = os.path.join(pardir_path, name_utf8)
|
||||
# This is gross, and probably incorrect too
|
||||
vrefnum, dirid, name = rr.selection[0].as_tuple()
|
||||
pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, ''))
|
||||
pardir_fsr = Carbon.File.FSRef(pardir_fss)
|
||||
pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8
|
||||
name_utf8 = unicode(name, 'macroman').encode('utf8')
|
||||
fullpath = os.path.join(pardir_path, name_utf8)
|
||||
if issubclass(tpwanted, unicode):
|
||||
return unicode(fullpath, 'utf8')
|
||||
return tpwanted(fullpath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue