don't test for os.name, as the mac stuff now all works under darwin/posix as well
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@279 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/t1Lib.py b/Lib/fontTools/t1Lib.py
index 40e67f6..ee862f5 100644
--- a/Lib/fontTools/t1Lib.py
+++ b/Lib/fontTools/t1Lib.py
@@ -25,7 +25,15 @@
import re
import os
-if os.name == 'mac':
+
+try:
+ import macfs
+except ImportError:
+ haveMacSupport = 0
+else:
+ haveMacSupport = 1
+
+if haveMacSupport:
try:
from Carbon import Res
except ImportError:
@@ -85,7 +93,7 @@
def read(path):
"""reads any Type 1 font file, returns raw data"""
normpath = string.lower(path)
- if os.name == 'mac':
+ if haveMacSupport:
fss = macfs.FSSpec(path)
creator, type = fss.GetCreatorType()
if type == 'LWFN':
@@ -234,7 +242,7 @@
f.write(chr(128) + chr(3))
finally:
f.close()
- if os.name == 'mac':
+ if haveMacSupport:
fss = macfs.FSSpec(path)
fss.SetCreatorType('mdos', 'BINA')
@@ -257,7 +265,7 @@
f.write(chunk)
finally:
f.close()
- if os.name == 'mac':
+ if haveMacSupport:
fss = macfs.FSSpec(path)
fss.SetCreatorType('R*ch', 'TEXT') # BBEdit text file