##// END OF EJS Templates
resourceutil: implement `contents()` to iterate over resources in a package...
Matt Harbison -
r44481:bba9149a default
parent child Browse files
Show More
@@ -55,6 +55,10 b' try:'
55 pycompat.sysstr(package), encoding.strfromlocal(name)
55 pycompat.sysstr(package), encoding.strfromlocal(name)
56 )
56 )
57
57
58 def contents(package):
59 for r in resources.contents(pycompat.sysstr(package)):
60 yield encoding.strtolocal(r)
61
58
62
59 except (ImportError, AttributeError):
63 except (ImportError, AttributeError):
60
64
@@ -72,3 +76,9 b' except (ImportError, AttributeError):'
72 return os.path.isfile(pycompat.fsdecode(path))
76 return os.path.isfile(pycompat.fsdecode(path))
73 except (IOError, OSError):
77 except (IOError, OSError):
74 return False
78 return False
79
80 def contents(package):
81 path = pycompat.fsdecode(_package_path(package))
82
83 for p in os.listdir(path):
84 yield pycompat.fsencode(p)
General Comments 0
You need to be logged in to leave comments. Login now