From 72f102ca1a6460faf1c2d39d9010d20ebaff9f36 Mon Sep 17 00:00:00 2001 From: Just Date: Wed, 29 Dec 1999 13:09:37 +0000 Subject: [PATCH] Revert current directory after glob'ing for *.xml files git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@42 4cde692c-a291-49d1-8350-778aa11640f8 --- ttCompile.py | 8 ++++++-- xml2tt.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ttCompile.py b/ttCompile.py index ea84fbd38..4ec866683 100644 --- a/ttCompile.py +++ b/ttCompile.py @@ -1,7 +1,7 @@ #! /usr/bin/env python """\ -usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-file] +usage: %s [-hvb] [-i TrueType-input-file] XML-file [TrueType-output-file] Translate an XML file (as output by tt2xml.py) to a TrueType font file. If the XML-file argument is a directory instead of a file, all files ending in '.xml' will be merged into one TrueType file. This is mostly @@ -46,8 +46,12 @@ tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose) if os.path.isdir(xmlPath): import glob + oldDir = os.getcwd() os.chdir(xmlPath) - for xmlFile in glob.glob("*.xml"): + files = glob.glob("*.xml") + os.chdir(oldDir) + for xmlFile in files: + xmlFile = os.path.join(xmlPath, xmlFile) tt.importXML(xmlFile) else: tt.importXML(xmlPath) diff --git a/xml2tt.py b/xml2tt.py index ea84fbd38..4ec866683 100644 --- a/xml2tt.py +++ b/xml2tt.py @@ -1,7 +1,7 @@ #! /usr/bin/env python """\ -usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-file] +usage: %s [-hvb] [-i TrueType-input-file] XML-file [TrueType-output-file] Translate an XML file (as output by tt2xml.py) to a TrueType font file. If the XML-file argument is a directory instead of a file, all files ending in '.xml' will be merged into one TrueType file. This is mostly @@ -46,8 +46,12 @@ tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose) if os.path.isdir(xmlPath): import glob + oldDir = os.getcwd() os.chdir(xmlPath) - for xmlFile in glob.glob("*.xml"): + files = glob.glob("*.xml") + os.chdir(oldDir) + for xmlFile in files: + xmlFile = os.path.join(xmlPath, xmlFile) tt.importXML(xmlFile) else: tt.importXML(xmlPath)