--- a/src/reportlab/lib/utils.py Wed Sep 09 12:55:01 2009 +0000
+++ b/src/reportlab/lib/utils.py Wed Sep 09 16:36:49 2009 +0000
@@ -1094,3 +1094,16 @@
['a', ',b', 'c']
'''
return ','.join([ ' ' + i.replace(',', ',,') + ' ' for i in l ])
+
+def findInPaths(fn,paths,isfile=True,fail=False):
+ '''search for relative files in likely places'''
+ exists = isfile and os.path.isfile or os.path.isdir
+ if exists(fn): return fn
+ pjoin = os.path.join
+ if not os.path.isabs(fn):
+ for p in paths:
+ pfn = pjoin(p,fn)
+ if exists(pfn):
+ return pfn
+ if fail: raise ValueError('cannot locate %r with paths=%r' % (fn,paths))
+ return fn