Commit 32f782c0 authored by Jack Jansen's avatar Jack Jansen

Don't attempt to create a dummy fsspec if the user cancelled out, just

return None.

For now, if the user asks for TEXT files files without type are also
accepted. But it is time to phase out StandardGetFile and friends, really.
parent d21c9f48
...@@ -12,6 +12,9 @@ _curfolder = None ...@@ -12,6 +12,9 @@ _curfolder = None
_movablemodal = 1 _movablemodal = 1
def _mktypelist(typelist): def _mktypelist(typelist):
# Workaround for OSX typeless files:
if 'TEXT' in typelist and not '\0\0\0\0' in typelist:
typelist = typelist + ('\0\0\0\0',)
if not typelist: if not typelist:
return None return None
data = 'Pyth' + struct.pack("hh", 0, len(typelist)) data = 'Pyth' + struct.pack("hh", 0, len(typelist))
...@@ -44,7 +47,7 @@ def _PromptGetFile(prompt, *typelist): ...@@ -44,7 +47,7 @@ def _PromptGetFile(prompt, *typelist):
if arg[0] != -128: # userCancelledErr if arg[0] != -128: # userCancelledErr
raise Nav.error, arg raise Nav.error, arg
good = 0 good = 0
fss = macfs.FSSpec(':cancelled') fss = None
else: else:
if rr.selection: if rr.selection:
fss = rr.selection[0] fss = rr.selection[0]
...@@ -74,7 +77,7 @@ def _StandardPutFile(prompt, default=None): ...@@ -74,7 +77,7 @@ def _StandardPutFile(prompt, default=None):
if arg[0] != -128: # userCancelledErr if arg[0] != -128: # userCancelledErr
raise Nav.error, arg raise Nav.error, arg
good = 0 good = 0
fss = macfs.FSSpec(':cancelled') fss = None
else: else:
fss = rr.selection[0] fss = rr.selection[0]
return fss, good return fss, good
...@@ -115,7 +118,7 @@ def _GetDirectory(prompt=None): ...@@ -115,7 +118,7 @@ def _GetDirectory(prompt=None):
if arg[0] != -128: # userCancelledErr if arg[0] != -128: # userCancelledErr
raise Nav.error, arg raise Nav.error, arg
good = 0 good = 0
fss = macfs.FSSpec(':cancelled') fss = None
else: else:
fss = rr.selection[0] fss = rr.selection[0]
return fss, good return fss, good
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment