Got rid of FSSpecs.

This commit is contained in:
Jack Jansen 2003-02-06 22:57:44 +00:00
parent 5aac4e6312
commit 5a79329547
1 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,6 @@
"""Parse sys/errno.h and Errors.h and create Estr resource""" """Parse sys/errno.h and Errors.h and create Estr resource"""
import re import re
import macfs
import string import string
from Carbon import Res from Carbon import Res
import os import os
@ -105,47 +104,47 @@ def parse_errors_h(fp, dict):
def main(): def main():
dict = {} dict = {}
fss, ok = macfs.PromptGetFile("Where is GUSI sys/errno.h?") pathname = EasyDialogs.AskFileForOpen(message="Where is GUSI sys/errno.h?")
if not ok: return if pathname:
fp = open(fss.as_pathname()) fp = open(pathname)
parse_errno_h(fp, dict) parse_errno_h(fp, dict)
fp.close() fp.close()
fss, ok = macfs.PromptGetFile("Select cerrno (MSL) or cancel") pathname = EasyDialogs.AskFileForOpen(message="Select cerrno (MSL) or cancel")
if not ok: return if pathname:
fp = open(fss.as_pathname()) fp = open(pathname)
parse_errno_h(fp, dict) parse_errno_h(fp, dict)
fp.close() fp.close()
fss, ok = macfs.PromptGetFile("Where is MacErrors.h?") pathname = EasyDialogs.AskFileForOpen(message="Where is MacErrors.h?")
if not ok: return if pathname:
fp = open(fss.as_pathname()) fp = open(pathname)
parse_errors_h(fp, dict) parse_errors_h(fp, dict)
fp.close() fp.close()
fss, ok = macfs.PromptGetFile("Where is mkestrres-MacErrors.h?") pathname = EasyDialogs.AskFileForOpen(message="Where is mkestrres-MacErrors.h?")
if not ok: return if pathname:
fp = open(fss.as_pathname()) fp = open(pathname)
parse_errors_h(fp, dict) parse_errors_h(fp, dict)
fp.close() fp.close()
if not dict: if not dict:
return return
fss, ok = macfs.StandardPutFile("Resource output file?", "errors.rsrc") pathname = EasyDialogs.AskFileForSave(message="Resource output file?", savedFileName="errors.rsrc")
if ok: if pathname:
writeestr(fss, dict) writeestr(fss, dict)
fss, ok = macfs.StandardPutFile("Python output file?", "macerrors.py") pathname = EasyDialogs.AskFileForSave(message="Python output file?", savedFileName="macerrors.py")
if ok: if pathname:
fp = open(fss.as_pathname(), "w") fp = open(pathname, "w")
writepython(fp, dict) writepython(fp, dict)
fp.close() fp.close()
fss.SetCreatorType('Pyth', 'TEXT') fss.SetCreatorType('Pyth', 'TEXT')
fss, ok = macfs.StandardPutFile("Text output file?", "errors.txt") pathname = EasyDialogs.AskFileForSave(message="Text output file?", savedFileName="errors.txt")
if ok: if pathname:
fp = open(fss.as_pathname(), "w") fp = open(pathname, "w")
k = dict.keys() k = dict.keys()
k.sort() k.sort()